Documentation

GoUp Payment Gateway by Product & Category

Show, hide, or restrict WooCommerce payment gateways according to products and product categories in the cart.

Plugin slug: goup-payment-gateway-by-product-category · Version: 1.0.5 · Author: GoUpWP · https://goupwp.com/plugins/payment-gateway-by-product-category

What it does

Hides or restricts WooCommerce payment methods according to the products and product categories in the cart. Typical uses: no cash on delivery for gift vouchers, bank transfer only for high-value equipment, a single gateway for subscription-like products. A per-rule message can tell the customer why a method is unavailable.

Works with the classic checkout, the Checkout Block and HPOS. Requires PHP 8.1.

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 Product & Category 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 Gateway Rules → Rules → Add rule.

  • Condition: Products (search by title, SKU or ID; variations are matched through their parent when "parent matches variations" is on) or Categories (optionally including child categories).
  • Match: ANY selected item in the cart, or ALL selected items present.
  • Action: Hide the selected gateways, or Allow only the selected gateways.
  • Customer message (optional): shown as a checkout notice once per session when the rule removed a gateway.
  • Priority and Stop processing control how several rules combine.

Settings: defaults for new rules, the message shown when no payment method remains, debug logging and the uninstall policy. Rules can be exported/imported as JSON.

Testing

The Test tab takes product IDs or SKUs, builds the same cart context the checkout uses, and shows the products' categories, every rule with whether it matched and what it removed, and the gateways that would be offered. Diagnostics summarises the environment for support tickets.

Developer hooks

  • goup_payment_gateway_rules( array $rules ), goup_payment_gateway_rule_matches( MatchResult, Rule, CartContext )
  • goup_payment_gateway_initial_gateways( array ), goup_payment_gateway_final_gateways( array, array $initial, CartContext, array $events )
  • goup_payment_gateway_cart_context( CartContext ), goup_payment_gateway_rules_manage_capability( 'manage_woocommerce' )
  • Actions: goup_payment_gateway_before_evaluate, goup_payment_gateway_after_evaluate.

Troubleshooting

  • Gateway still visible — the product may be in the cart as a variation whose parent is not selected, or another plugin re-adds gateways after this one. Use the Test tab with the exact cart, then check WooCommerce → Status → Logs with debug logging enabled.
  • "Incompatible with HPOS" shown by WooCommerce — fixed in 1.0.3; update the plugin.

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.5 27 September 2026 · tested with WordPress 7.1

  • Checkout safety: added recommended Safe Mode that restores the exact incoming WooCommerce gateway set when matching rules would otherwise remove every method; Strict Mode remains available for deliberate zero-gateway policies.
  • Order payment: product/category rules now evaluate authenticated pay-for-order links from order items after exact order-key verification.
  • Gateway integrity: extension filters can remove methods but cannot inject new gateways or replace WooCommerce gateway objects; malformed filter results fail open.
  • Data integrity: one validator now protects rule saves and imports, repairs duplicate IDs, bounds every collection/text field, and prevents enabled rules from referencing missing products, categories or gateways.
  • Import security: requires the exact schema, valid upload status, a non-empty file of at most 2 MB and no more than 500 rules; malformed all-invalid imports leave existing rules untouched.
  • Performance: product-category ancestry is expanded once per distinct category and product-category lookups are cached per resolver instead of repeated for every rule/category pair.
  • Privacy and UX: notices no longer persist as session flags, logs are strictly allowlisted, uninstall transient deletion uses escaped prepared LIKE values, and every screen uses the shared GoUpWP blue design and logo system.
  • QA: expanded focused coverage from 4 tests / 6 assertions to 14 tests / 35 assertions and added real WooCommerce Safe/Strict zero-gateway checks.

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.
  • Fixed HPOS and Checkout Block compatibility declarations being ignored (they were registered outside before_woocommerce_init), which showed the plugin as incompatible.
  • New Test tab: enter product IDs or SKUs and see which gateways a customer with that cart would be offered and which rules fired.

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

Release 1.0.1.