- ステータス
- 解決済み
- 報告対象
- WPML Multilingual & Multicurrency for WooCommerce 4.12.0
- 解決されたバージョン
- WCML 5.1.0
問題の概要
WPML Multilingual & Multicurrency for WooCommerceでは、通貨ごとに異なるBACSアカウントを設定できます。しかし現在WCMLでは、選択した言語に有効なアカウントではなく、ショップのすべてのBACSアカウントが注文確認ページとメールに表示されます。
回避策
続行する前にサイトの完全なバックアップを作成してください。
- /wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-bacs.php.を開きます。
- 35行目を探します。
- 変更前:
if ( $gateway_setting && 'all' !== $gateway_setting['value'] ) { if ( 'all_in' === $gateway_setting['value'] ) { $bacs_accounts_currencies = get_option( WCML_WC_Gateways::WCML_BACS_ACCOUNTS_CURRENCIES_OPTION, [] ); foreach ( $bacs_accounts_currencies as $account_key => $currency ) { if ( $gateway_setting['currency'] === $currency ) { $allowed_accounts[] = $accounts[ $account_key ]; } } } else { $allowed_accounts[] = $accounts[ $gateway_setting['value'] ]; } } return $allowed_accounts ? $allowed_accounts : $accounts; - 変更後:
if ( $gateway_setting && 'all' !== $gateway_setting['value'] ) { $woocurrency = get_woocommerce_currency(); // to get default currency if ( 'all_in' === $gateway_setting['value'] ) { $bacs_accounts_currencies = get_option( WCML_WC_Gateways::WCML_BACS_ACCOUNTS_CURRENCIES_OPTION, [] ); foreach ( $bacs_accounts_currencies as $account_key => $currency ) { if ( $gateway_setting['currency'] === $currency ) { $allowed_accounts[] = $accounts[ $account_key ]; } if ( $gateway_setting['currency'] === NULL && $woocurrency && $woocurrency === $currency ) { //new condition for default currency $allowed_accounts[] = $accounts[ $account_key ]; } } } else { $allowed_accounts[] = $accounts[ $gateway_setting['value'] ]; } } return $allowed_accounts ? $allowed_accounts : $accounts; - WooCommerce > WooCommerce Multilingual & Multicurrency > マルチ通貨に移動します。
- 「通貨」セクションに追加された各通貨を編集します。
- 各通貨の「決済ゲートウェイ」オプションを有効化します。
- 変更を保存します。