Skip Navigation

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, 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 );
    
  • Edit it and add your site’s URL domains instead of the example.

2 Responses to “WooCommerce Subscriptions - It looks like this site has moved or is a duplicate site”

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>