Open
Reported for: WooCommerce Multilingual & Multicurrency 5.3.5
Overview of the issue
Currently, it is not possible to save any changes in the Country availability of your WooPayments settings when using WooCommerce Multilingual.
This issue is similar to one reported for WooCommerce Stripe Payment Gateway.
Workaround
In the meantime, you can consider one of the following solutions:
1) If you want to limit WooPayments to a single country (i.e. Spain) you can use the following code:
// Limit Stripe to Spain. add_filter( 'woocommerce_available_payment_gateways', function( $gateways ) { $country = WCMLMultiCurrencyGeolocation::getUserCountry(); if ( $country ) { if ( 'ES' !== $country ) { unset( $gateways['woocommerce_payments'] ); } } return $gateways; } );
2) On the other hand, if you want limit your WooPayments for several countries, you can use this variation:
// Limit WooPayments for several countries add_filter( 'woocommerce_available_payment_gateways', function( $gateways ) { $country = WCMLMultiCurrencyGeolocation::getUserCountry(); if ( $country ) { // List of country codes to check against $country_codes = array('ES', 'FR', 'DE'); if ( !in_array($country, $country_codes) ) { unset( $gateways['woocommerce_payments'] ); } } return $gateways; } );
You can add the above code to the functions.php file in your theme.
Don’t forget to adjust the country code to your needs (in both examples we use ‘ES’ for Spain).