WPML

Overview of the Issue

Currently, it is not possible to save any changes in the Country availability of your WooPayments settings when using WPML Multilingual & Multicurrency for WooCommerce.

This issue is similar to one reported for WooCommerce Stripe Payment Gateway.

Workaround

This issue is fixed. Updating to the latest version solves it on your site, so you only need this workaround if you can’t update yet.

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 = WCML\MultiCurrency\Geolocation::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 = WCML\MultiCurrency\Geolocation::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).

Still Seeing This Issue?

If updating doesn’t fix it, ask a support question and we’ll look into it with you.

Ask a support question

All known issues