This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is experiencing issues with language per domain configuration and WooCommerce Subscriptions displaying a staging notice.
Solution:
If you're experiencing issues with language per domain and WooCommerce Subscriptions showing a staging notice, we recommend adding the following code to the
functions.php
file in your theme folder:
// 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( 'https://your-live-site.com', 'http://your-other-live-site.com', // 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; } } return $url; } add_filter( 'wc_subscriptions_site_url', 'wpml_compsupp7065_filter_wc_subscriptions_site_url', 10, 4 );
Please ensure to replace the
$allowed_url_list
array with your site's URLs.
If this solution doesn't seem relevant to your issue, please open a new support ticket with us.
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 6 replies, has 2 voices.
Last updated by 1 year, 9 months ago.
Assisted by: Osama Mersal.