This thread is resolved. Here is a description of the problem and solution.
Problem:
Cart items are not synced between languages with custom lang switcher.
Solution:
The user is tweaking our code example from WPML's documentation here.
If your site is set to 'A different domain per language' Language URL format, then this code example will not sync the cart's content when you switch the language. But only by adding a class (wpml-ls-item) the element that holds the language's link, the issue is solved. This is the corrected code example.
function language_selector_flags(){ $languages = icl_get_languages('skip_missing=0&orderby=code'); if(!empty($languages)){ foreach($languages as $l){ if(!$l['active']) echo '<a class="wpml-ls-item" href="'.$l['url'].'">'; echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" />'; if(!$l['active']) echo '</a>'; } } }
Relevant Documentation:
https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Our next available supporter will start replying to tickets in about 3.22 hours from now. Thank you for your understanding.
This topic contains 18 replies, has 2 voices.
Last updated by 4 years, 11 months ago.
Assisted by: Itamar.