跳过导航

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”

留下回复

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.

您可以使用这些标签:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>