This thread is resolved. Here is a description of the problem and solution.
Problem:
The client was experiencing an issue with WooCommerce Subscriptions and WPML, even after implementing a suggested workaround.
Solution:
We recommended updating the workaround code. Here is the step-by-step solution:
// WPML Workaround for compsupp-7065<br />function wpml_compsupp7065_filter_wc_subscriptions_site_url( $url, $path, $scheme, $blog_id ) {<br /><br /> // Define your list of allowed URLs - DO NOT add staging versions here<br /> $allowed_url_list = array(<br /> 'https://pulskuren.no',<br /> 'https://thepulsecure.com',<br /> // Add more URLs as needed<br /> );<br /><br /> // Get the current WordPress home URL<br /> $current_home_url = home_url();<br /> $current_home_url = parse_url($url);<br /> $current_home_url = $current_home_url['host'];<br /><br /> // Check if the current home URL is in the list<br /> foreach ( $allowed_url_list as $listed_url ) {<br /><br /> if ( str_contains( $listed_url, $current_home_url) ) {<br /> // Replace the $url variable with the listed URL<br /> $url = $listed_url;<br /> add_filter('woocommerce_subscriptions_is_duplicate_site', '__return_false');<br /> break; <br /> }<br /> }<br /><br /> return $url;<br />}<br /><br />add_filter( 'wc_subscriptions_site_url', 'wpml_compsupp7065_filter_wc_subscriptions_site_url', 10, 4 );Please note that this solution might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, please open a new support ticket in the WPML support forum.
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.
This topic contains 8 replies, has 2 voices.
Last updated by 1 year, 10 months ago.
Assisted by: Osama Mersal.