تخطي الملاحة

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”

ترك رد

يُرجى البقاء في الموضوع والتزام الاحترام للآخرين. إذا كنت بحاجة إلى مساعدة بشأن المشكلات التي لا تتعلق بهذا المنشور، فاستخدم منتدى الدعم لبدء محادثة أو إرسال تذكرة.

يمكنك استخدام هذه العلامات:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>