Skip Navigation

Open

Reported for: WooCommerce Multilingual 4.12.0

Overview of the issue

WooCommerce Multilingual allows you to set a different BACS account per currency. However, WCML currently lists all your different shop BACS accounts on the confirmation order page and emails instead of the valid one for the selected language.

Workaround

Please make a full backup of your site before proceeding.

  1. Open /wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-bacs.php.
  2. Look for line 35.
  3. Replace:
    		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;
    
  4. With:
    		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;
    

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>