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.
Hi
I have tested this solution as a workaround for Woo Subscription and WPML. The error is still there. Can you please have a look and see if it needs some adjustments?
// WPML Workaround for compsupp-7065
function wpml_compsupp7065_filter_wc_subscriptions_site_url( $url, $path, $scheme, $blog_id ) {
// Define your list of allowed URLs - DO NOT add staging versions here
$allowed_url_list = array(
'hidden link',
'hidden link',
// Add more URLs as needed
);
// Get the current WordPress home URL
$current_home_url = home_url();
$current_home_url = parse_url($url, PHP_URL_PATH);
$current_home_url = $current_home_url['host'];
// Check if the current home URL is in the list
foreach ( $allowed_url_list as $listed_url ) {
if ( str_contains( $listed_url, $current_home_url) ) {
// Replace the $url variable with the listed URL
$url = $listed_url;
break;
}
}
Thanks for contacting WPML forums support. I'll be glad to help you today.
First of all, sorry for the late reply; it was due to a higher workload. I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP) Preferably to a test site where the problem has been replicated.
Your answer will be private, meaning only you and I can access it.
❌ Please backup your database and website ❌
✙ I need your permission to deactivate and reactivate the plugins and themes and change site configurations. This is also why the backup is critical.
✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.
Hi Osama
I have a fresh staging site, but
unfortunately it doesn't not have custom domain. Can you still use this, or do you have to do a copy of the live site? It's a quite large Buddyboss/Memberpress site (over 40gb).
Hi again Osama
I will set up an staging site with diffeent domains pr language and Woo subscription during the day or tomorrow. I belive this will be a better way for you to adjust the script.
If you provide me with the form again, I will provide you with login details for the staging server.
Thanks for your patience. Please check if the issue is fixed. Our 2nd tier support team has added the following code (Updated Workaround) to your site.
// WPML Workaround for compsupp-7065
function wpml_compsupp7065_filter_wc_subscriptions_site_url( $url, $path, $scheme, $blog_id ) {
// Define your list of allowed URLs - DO NOT add staging versions here
$allowed_url_list = array(
'<em><u>hidden link</u></em>',
'<em><u>hidden link</u></em>',
// Add more URLs as needed
);
// Get the current WordPress home URL
$current_home_url = home_url();
$current_home_url = parse_url($url);
$current_home_url = $current_home_url['host'];
// Check if the current home URL is in the list
foreach ( $allowed_url_list as $listed_url ) {
if ( str_contains( $listed_url, $current_home_url) ) {
// Replace the $url variable with the listed URL
$url = $listed_url;
add_filter('woocommerce_subscriptions_is_duplicate_site', '__return_false');
break;
}
}
return $url;
}
add_filter( 'wc_subscriptions_site_url', 'wpml_compsupp7065_filter_wc_subscriptions_site_url', 10, 4 );