Resolved
Reported for: WooCommerce Multilingual & Multicurrency 5.3.0
Resolved in: WooCommerce Multilingual & Multicurrency 5.3.1
Overview of the issue
If you are using WooCommerce Multilingual and its standalone mode with Stripe as your payment gateway, you may encounter issues when attempting to make payments in a secondary currency. Specifically, the Stripe payment gateway may not be available during checkout in the secondary currency if it is not set.
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-payment-gateway-stripe.php file.
- Look for line 78.
- Change:
if ( $gateway_settings && isset( $gateway_settings[ $client_currency ] ) ) { $gateway_setting = $gateway_settings[ $client_currency ]; if ( isset( $gateway_setting['publishable_key'] ) && isset( $gateway_setting['secret_key'] ) ) { $settings['publishable_key'] = $gateway_setting['publishable_key']; $settings['secret_key'] = $gateway_setting['secret_key']; } if ( isset( $gateway_setting['test_publishable_key'] ) && isset( $gateway_setting['test_secret_key'] ) ) { $settings['test_publishable_key'] = $gateway_setting['test_publishable_key']; $settings['test_secret_key'] = $gateway_setting['test_secret_key']; } }
- For:
if ( $gateway_settings && isset( $gateway_settings[ $client_currency ] ) ) { $gateway_setting = $gateway_settings[ $client_currency ]; if ( ! empty( $gateway_setting['publishable_key'] ) && ! empty( $gateway_setting['secret_key'] ) ) { $settings['publishable_key'] = $gateway_setting['publishable_key']; $settings['secret_key'] = $gateway_setting['secret_key']; } if ( ! empty( $gateway_setting['test_publishable_key'] ) && ! empty( $gateway_setting['test_secret_key'] ) ) { $settings['test_publishable_key'] = $gateway_setting['test_publishable_key']; $settings['test_secret_key'] = $gateway_setting['test_secret_key']; } }
We updated the plugin yesterday and this morning had several emails from customers alerting us to this issue. Took a while to come across this post and fix, which does resolve the issue.
However note there is a missing { on line 3 which causes a fatal error.
Will this fix code be included in the next plugin update?
Hello there,
Thank you for the heads up, I just fixed and added the «{» missing.
On the other hand, this should have been solved in WooCommerce Multilingual & Multicurrency 5.3.1 which was already release, could you please give it a try?
Regards
5.3.1 is not showing as available on the Plugins page
If you don’t see the update available, please follow this tutorial:
https://wpml.org/faq/install-wpml/#checking-for-updates