- ステータス
- 解決済み
- 関連するプラグイン/テーマ
- WooCommerce Subscriptions
- トピックタグ
- Compatibility
問題の概要
WPMLのドメインごとの言語のセットアップでWooCommerce Subscriptionsを使用している場合、ステージングサイトまたは複製サイトの可能性に関する警告通知が誤って表示されることがあります。この問題は、同じセットアップ内の1つのドメインで自動支払いを有効にし、その後別のドメインで確認した場合に発生する可能性があります。
このサイトは移動したか、複製サイトであるようです。ステージング環境やテスト環境からの二重支払いを防ぐため、WooCommerce Subscriptionsはこのサイトでの自動支払いとサブスクリプション関連のメールを無効にしました。WooCommerce Subscriptionsは、https://www.domain.com をサイトのURLと見なしています。詳細はこちら »。
回避策
続行する前に、サイトの完全なバックアップを必ず取得してください。
- テーマのfunctions.phpファイルを開きます。
- 次のスニペットを追加します。
// 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 ); - 編集して、例の代わりにサイトのURLドメインを追加します。