Documentation

GoUp Payment Gateway by Country / Region

Control WooCommerce payment gateways by billing or shipping country, state, region, or shipping zone.

Plugin slug: goup-payment-gateway-by-country-region · Version: 1.0.6 · Author: GoUpWP · https://goupwp.com/plugins/payment-gateway-by-country-region

What it does

Shows, hides or restricts WooCommerce payment methods based on where the customer is: billing or shipping country, state/region, or the WooCommerce shipping zone the order falls into. Typical uses: cash on delivery only in your home country, bank transfer only for the EU, a specific gateway for one state.

Works with the classic checkout, the Checkout Block (rules re-evaluate as the address changes), the "pay for order" page and HPOS.

Installation

  1. Download the plugin ZIP from your GoUpWP account (Account → Licenses → Download).
  2. In WordPress go to Plugins → Add New → Upload Plugin, choose the ZIP and click Install Now, then Activate.
  3. WooCommerce must be installed and active; the plugin shows a notice and stays idle until it is.
  4. Open WooCommerce → License: Payment Gateway by Country / Region and paste the license key from your account. Activation unlocks one-click updates and support for this site. A localhost, *.test, *.local or staging. site counts as a staging activation and does not use your production seat.

The plugin keeps working if the license expires: only updates and support pause until it is renewed.

Setup

Open WooCommerce → Payment by Country/Region → Rules → Add rule.

  • Location type: Country (pick countries), State (pick a country, then its states) or Shipping zone (pick your WooCommerce zones).
  • Address source: evaluate the billing or the shipping address. Shipping rules only apply when the cart needs shipping and a destination is known.
  • Action: Disable the selected gateways, or Allow only the selected gateways (everything else is hidden).
  • Gateways: choose from the gateways registered on the site.
  • Priority: lower numbers run first; every matching rule is applied in order, so a later Allow only can narrow a set that an earlier Disable already reduced.

Settings: Zero-gateway safety — Safe (default) restores the original gateways if your rules would leave the customer with none, and logs a warning; Strict lets the checkout show no payment methods. Rules can be exported and imported as versioned JSON. Imports are limited to 500 rules; malformed files cannot overwrite working rules, and otherwise-valid rules with unavailable locations or gateways are imported disabled.

Testing

The Tester tab simulates a billing/shipping country, state and zone and shows which rules match and which gateways remain. Diagnostics lists zones, gateways and the last evaluation for support tickets.

On an order-pay URL, stored order location is used only after WooCommerce's order key has been validated. The plugin never adds or restores a gateway that WooCommerce or another extension has already made unavailable.

Developer hooks

  • goup_pgcr_rules( array ), goup_pgcr_matching_rules( array, LocationContext )
  • goup_pgcr_available_gateways( array $gateways, array $original, array $matched, LocationContext )
  • goup_pgcr_original_gateways( array, LocationContext ), goup_pgcr_safe_mode( bool, LocationContext, array $matched )
  • goup_pgcr_location_context( LocationContext ), goup_pgcr_billing_country, goup_pgcr_shipping_country, goup_pgcr_billing_state, goup_pgcr_shipping_state ( string, WC_Customer )
  • goup_pgcr_shipping_zones( array $zone_ids ), goup_pgcr_zone_match_strategy( 'any'|'all', … )

Troubleshooting

  • Rule does not apply — check the address source: a shipping rule needs a shipping address and a cart that needs shipping; use a billing rule for virtual products. Enable Debug logging and read WooCommerce → Status → Logs; each evaluation logs location-presence flags, matched rule IDs and final gateway IDs without exact country, state, zone IDs or customer data.
  • All gateways reappear — Safe mode kicked in because the rules removed every gateway; adjust the rules or switch to Strict.

Updates and licensing

  • Updates arrive through the normal Dashboard → Updates and Plugins screens. Every package is downloaded over a signed, time-limited link and verified against its SHA-256 checksum before WordPress installs it.
  • View details on the Plugins screen shows the changelog for the new version.
  • If the license is not active you still see that an update exists; the row explains that renewing restores one-click updates.
  • The license page shows the installed version, the environment this site was classified as (production or staging), your activation counts and the renewal date, and has a Check for updates button.
  • Deactivate on this site frees the seat so the key can be used on another site. Deleting the plugin from the Plugins screen also frees the seat automatically.
  • Nothing is sent to goupwp.com except the license key, an installation ID, the site URL and the WordPress, PHP and plugin versions used for compatibility checks.

Support and maintenance

  • Open a ticket from Account → Support on goupwp.com; include the output of the plugin's Diagnostics tab.
  • Keep WordPress, WooCommerce and the plugin updated and test changes on a staging site first.
  • The plugin declares compatibility with WooCommerce High-Performance Order Storage (HPOS) and the Cart and Checkout Blocks, and is translation-ready (languages/).
  • Uninstalling removes the plugin's data only when the Delete data on uninstall option is enabled, so a reinstall keeps your configuration; license data is always removed.

Release history

1.0.6 27 September 2026 · tested with WordPress 7.1

  • Checkout correctness: cached location and shipping-zone context now invalidates whenever the customer destination or shipping requirement changes within the same request.
  • QA: added a real WooCommerce transition gate that changes one cart from France to the configured UK shipping zone and verifies the bank-only rule immediately replaces the prior country result.

1.0.5 27 September 2026 · tested with WordPress 7.1

  • Correctness: location filters now run before shipping-zone resolution, and any later context change recomputes zones so country/state and zone rules cannot disagree.
  • Security: order-pay location is used only when its order key is valid; debug logs no longer include exact customer country, state or zone IDs.
  • Reliability: malformed developer-filter output fails safely, and filters cannot add, restore or replace a gateway WooCommerce did not provide.
  • Import safety: exact schema, real upload size, JSON validity and a 500-rule cap are enforced; malformed rows cannot erase working rules and unavailable gateway/location references import disabled.
  • Performance: location and shipping-zone context is resolved once per request; rule collections are cached and normalized.
  • Admin: truthful bulk/import results, HTTP 403 capability denials, defensive diagnostics and consistent GoUpWP-blue cards, status pills and tester output.

1.0.4 26 September 2026 · tested with WordPress 7.1

  • GoUpWP admin identity: every plugin screen now opens with a GoUpWP header showing the plugin name, version, documentation, support and licence status.
  • GoUpWP styling for settings, rule tables, tabs, cards and buttons, scoped to this plugin's screens so WordPress and other plugins are untouched.
  • GoUpWP mark on the Plugins screen, Documentation and Support links in the plugin row, and GoUpWP icons on the Dashboard → Updates screen.

1.0.3 20 September 2026 · tested with WordPress 7.1

  • Updates: the installer now fetches a freshly signed download link at install time and verifies the SHA-256 checksum, so "Update now" works hours after WordPress last checked for updates.
  • Updates: update checks are cached for six hours and the Plugins screen shows a clear message (with a link to the license page) when an update exists but the license is not active.
  • License screen: named per plugin in the WooCommerce menu, shows the installed version and a "Check for updates" button, and every string is translatable.
  • Plugins screen: Settings and License links on the plugin row.
  • Uninstall: releases the license seat on goupwp.com and removes all license data, regardless of the data-retention setting.
  • Code style: all source files expanded to readable, documented PHP.
  • Unit tests covering country, state, zone and priority evaluation plus safe mode.

1.0.2 20 September 2026 · tested with WordPress 7.1

  • License screen now explains activation failures (unrecognised key, wrong plugin, site limit reached, expired) and shows the environment, activation counts and end date.
  • Activate and Deactivate always contact goupwp.com immediately instead of waiting out a network backoff.

1.0.1 20 September 2026 · tested with WordPress 7.1

  • Added the GoUpWP licensing and update client.
  • Normalized plugin headers and code style.