This thread is resolved. Here is a description of the problem and solution.
Problem:
The client needed to apply a fix for the WooCommerce Stripe Payment Gateway to limit the Stripe SEPA method to EU countries only, but the provided code snippet did not work for multiple countries.
Solution:
We recommended using a modified code snippet that checks against a group of EU countries instead of using multiple if-else statements. Here is the code to use:
// Limit Stripe to a group of EU countries only.<br />add_filter( 'woocommerce_available_payment_gateways', function( $gateways ) {<br /> $country = WCML\MultiCurrency\Geolocation::getUserCountry();<br /> // List of EU country codes<br /> $eu_countries = array('AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK');<br /> if ( $country ) {<br /> // Check if the country is not in the list of EU countries<br /> if ( !in_array($country, $eu_countries) ) {<br /> unset( $gateways['stripe'] );<br /> }<br /> }<br /><br /> return $gateways;<br />} );
We also noted that this code is a helpful adjustment and has not undergone official testing by our team, nor will it be supported by us. We advised the client to ensure they have a complete, working backup of their system before implementation.
Please note that this solution might be irrelevant due to being outdated or not applicable to your case. If this is the case, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 4 replies, has 2 voices.
Last updated by 1 year, 2 months ago.
Assisted by: Bobby.