ナビゲーションをスキップ

Open

Topic Tags: Compatibility

Overview of the issue

If you are using WooCommerce Subscriptions with a WPML language-per-domain setup, you might encounter a notice incorrectly warning about a potential staging or duplicate site. This issue can arise when automatic payments are enabled on one domain and then checked on another domain within the same setup.

It looks like this site has moved or is a duplicate site. WooCommerce Subscriptions has disabled automatic payments and subscription related emails on this site to prevent duplicate payments from a staging or test environment. WooCommerce Subscriptions considers https://www.domain.com to be the site’s URL. Learn more ».

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open your theme’s functions.php file.
  • Add the following snippet:
    // 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://www.domain.com',
            'https://www.domain.nl',
            // 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 );
    
  • Edit it and add your site’s URL domains instead of the example.

2件の返信 へ “WooCommerce Subscriptions - It looks like this site has moved or is a duplicate site”

    • Hello there,
      If this workaround doesn’t help, please open a chat in our assistance channel. We will check if we need to adapt this workaround to your case.

返信を投稿

トピックに沿って他の人を尊重してください。この投稿に関連しない問題について助けが必要な場合は、サポートフォーラムを使用してチャットを開始するかチケットを送信してください。

以下のタグを使用できます:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>