Skip to content
Advertisement

Disable all payment gateways except BACS based on geo-ip country in Woocommerce

In Woocommerce, I am using the code made from this answer thread which enables ALL payment gateways if the user’s GEO IP is from an array of allowed countries. Here the allowed country code that I want is “SE” (Sweden).

What I would like is to disable all payment gateways except BACS to become available if the GEO IP is outside of Sweden (the pre-defined allowed country).

Any help is appreciated.

Advertisement

Answer

The following code will disable all available payment gateways except BACS for non allowed GEO IP defined countries (Here Sweden):

JavaScript

Code goes in functions.php file of your active child theme (or active theme). Tested and works.

Related: Disable payment gateways based on user country geo-ip in Woocommerce

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement