Multisite-Language-Switcher
Multisite-Language-Switcher copied to clipboard
Not working for WooCommerce product
I can link my English product post to the German one but the language switcher does not link to it on the front end. It links to German home instead.
I installed WooCommerce and faced a problem similar to this here: https://github.com/lloc/Multisite-Language-Switcher/wiki/Change-the-generated-URLs
A workaround would be:
function my_msls_options_get_permalink( $url, $language ) {
if ( 'de_DE' == $language ) {
$url = str_replace( '/product/', '/produkt/', $url );
}
return $url;
}
add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );
But a will let this issue open as bug.
I'm running into the same issue but your workaround is working great for now. Thanks!
Here is an interesting solution if you create your own custom post types with localized slugs ... http://wordpress.stackexchange.com/questions/30021/theme-localization-of-slugs-custom-post-types-taxonomies
I'm seeing the same problem with WooCommerce's custom taxonomies. WooCommerce now uses custom rewrite rules which the user can define in Settings > Permalinks. If I set a different "Product Category Base" for each site, then MSLS generates links that pick the right slug for the term but the rewrite rules (category base) from the current site.
Example
Product Category Bases
en_US: product-category fr_FR: categorie-produit
Product Categories
en_US: bicycles fr_FR: velos
The fr_FR link generated on /product-category/bicycles/
is /product-category/velos/
instead of /categorie-produit/velos/
The filter mentioned in the workaround above is not called in MslsOptionsTax->get_postlink(), so there is no way to alter the URL.
In any case, URLs should be built with the rewrite rules from the corresponding blog/language. I've taken a crack at it but have not gotten it to work yet. I'm not familiar with WP_Rewrite, unfortunately...
Interesting! I will look into this very soon...
Hi Dennis, I would like to ask whether a solution/workaround has been found already for the problem mentioned by last commenter, brocheafoin (commented on 5 Feb 2015 ) ? Also, probably superfluously but anyway, the problem in my case in detail below;
I have 2 Wordpress websites with each their own domain and configured for Wordpress multisite, with MU-domain-mapping succesfully installed. Furthermore, I have Woocommerce and Multisite Language Switcher installed and they work excellently together, except with 'product categories'.
site 1: degoudeneeuw.eu site 2: thegoldenage.nl
Explanation of problem; when I go to thegoldenage.nl --> Jewellery --> Brooches --> Design Brooches and then click on Country Flag: the Netherlands (above American Flag), I get: 'Die pagina kon niet gevonden worden' (= page not found) ERROR 404.
the url of the english(US) page; http://thegoldenage.nl/product-category/jewellery/brooches/design-brooches/ the url of the error page (Netherlands language); http://degoudeneeuw.eu/product-category/sieraden/broches/design-broches/ Note: the correct url should be with categorie instead of category (correct: http://degoudeneeuw.eu/product-categorie/sieraden/broches/design-broches/)
Can you give any advice or solution for the problem ? Thanks in advance
@lloc your solution works for us, thanks ;)