- Status
- Resolved
- Reported for
- WPML Multilingual & Multicurrency for WooCommerce 4.12.6
- Resolved in
- WooCommerce Multilingual & Multicurrency 5.4.0
- Related plugin/theme
- WooCommerce Stripe Payment Gateway
Overview of the issue
Currently, it is not possible to save any changes in the Country availability of your Stripe settings when using WPML Multilingual & Multicurrency for WooCommerce and WooCommerce Stripe Payment Gateway.
Our developers are aware of this situation. We reached out to the Stripe team and are still waiting for their reply.
Workaround
In the meantime, you can consider one of the following solutions:
1) If you want to limit Stripe 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 = WCML\\MultiCurrency\\Geolocation::getUserCountry();
if ( $country ) {
if ( 'ES' !== $country ) {
unset( $gateways['stripe'] );
}
}
return $gateways;
} );2) On the other hand, if you want to exclude a certain country, you can use this variation:
// Limit Stripe to all countries except Spain.
add_filter( 'woocommerce_available_payment_gateways', function( $gateways ) {
$country = WCML\\MultiCurrency\\Geolocation::getUserCountry();
if ( $country ) {
if ( 'ES' === $country ) {
unset( $gateways['stripe'] );
}
}
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).