Skip to content

Hide unregistered payment gateways from checkout - #3044

Open
the-sohan wants to merge 1 commit into
sovware:developmentfrom
the-sohan:fix/remove-unregistered-checkout-gateways
Open

the-sohan wants to merge 1 commit into
sovware:developmentfrom
the-sohan:fix/remove-unregistered-checkout-gateways

Conversation

@the-sohan

@the-sohan the-sohan commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

When a payment gateway extension is deactivated or deleted, its key can remain in the saved active_gateways option. Checkout previously rendered that stale key directly, so customers could still see a Stripe payment option even though Stripe was no longer registered and could not process the payment.

ATBDP_Gateway::get_active_gateways() now intersects the saved gateway keys with the currently registered payment processors. This removes stale gateways while preserving the configured order and automatically restores an enabled gateway when its extension registers the processor again. A standalone regression test covers removed, registered, and invalid-option cases. The changed gateway file also includes one adjacent concat-spacing correction required by the changed-file PHPCS check.

How to reproduce the issue or test the changes:

  1. Activate the Stripe extension, enable Stripe as a payment gateway, and save the settings.
  2. Deactivate or delete the Stripe extension without resaving the payment gateway settings, then open checkout. Before this change, checkout still shows Stripe from the stale saved option.
  3. Check out this change and reload checkout. Verify that only registered gateways, such as Bank Transfer, are shown.
  4. Reactivate Stripe while it remains selected in the saved option. Verify that Stripe appears again because its payment processor is registered.

Local verification:

  • php tests/php/checkout-active-gateways.php
  • php tests/php/listing-import-taxonomy-cache.php
  • php tests/php/listing-taxonomy-subterms.php
  • php -l includes/gateways/class-gateway.php
  • php -l tests/php/checkout-active-gateways.php
  • php -d 'error_reporting=E_ALL & ~E_DEPRECATED' vendor/bin/phpcs --standard=phpcs.xml --warning-severity=0 includes/gateways/class-gateway.php tests/php/checkout-active-gateways.php
  • git diff --check
  • Manual checkout verification with Stripe deactivated, then reactivated

Notes:

  • The repository's bundled WordPress Coding Standards dependency emits a PHP 8.5 deprecation from PHPCSHelper.php; local PHPCS was run with deprecations suppressed. The relevant files pass the configured standard.

Screenshots

Before

Checkout showing a stale Stripe payment option

Checkout shows Stripe after the Stripe extension has been deactivated because the stale saved gateway key was rendered directly.

After

Checkout showing only the registered Bank Transfer payment option

Checkout now shows only Bank Transfer while Stripe is deactivated; reactivating Stripe makes it available again.

Checklist

@the-sohan
the-sohan force-pushed the fix/remove-unregistered-checkout-gateways branch from 9aa8a7f to f9ad6b9 Compare September 29, 2026 04:56
@the-sohan
the-sohan marked this pull request as ready for review September 29, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant