Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gateway ordering to prioritise all WooPayments gateways #10480

Open
FangedParakeet opened this issue Mar 3, 2025 · 0 comments
Open

Fix gateway ordering to prioritise all WooPayments gateways #10480

FangedParakeet opened this issue Mar 3, 2025 · 0 comments
Assignees
Labels
focus: checkout payments type: bug The issue is a confirmed bug.

Comments

@FangedParakeet
Copy link
Contributor

Describe the bug

When WooPayments is enabled with multiple payment methods also enabled, we expect that all of these payment methods should appear together at checkout and prioritised to appear at the top of the list of enabled payment gateways. However, this does not currently appear to be the case: only the CC payment method is prioritised and the other gateways will appear separately nearer to the bottom of the list of available gateways.

WooPayments gateways separated
WooPayments list of available gateways separated at checkout

I believe this is happening, because while we do have code to reorder the list of available payment gateways and prioritise WooPayments, currently this only acts on the CC gateway with default woocommerce_payments slug. With the split UPE integration, each payment method is registered as its own separate payment gateway with a unique slug (i.e. woocommerce_payments_{ PAYMENT METHOD ID }). These additional gateways are not currently included in this gateway reordering.

We would like to amend this by improving this line of code to loop through all available gateway slugs and perform the same operation, so that these additional WooPayments gateways are also prioritised.

The desirable order of payment gateways at checkout should be as follows.

  • WooPayments CC
  • Other WooPayments PMs
  • Other non-WooPayments PMs

Note that, while I believe I have identified the source of this misalignment, we should also investigate whether ordering on the blocks checkout relies on the same code or needs a separate solution. Ideally, we would like to resolve this issue for all WooPayments gateways on both blocks and shortcode checkouts, but if blocks checkouts require a more involved or unrelated fix, we could move this to a separate issue, if the effort required is deemed substantial enough.

To Reproduce

Currently, the ordering of payment gateways by WooCommerce is dependent on the order that payment gateways are enabled, whereby newer payment gateways enabled more recently will receive lower prioritisation in this list of presented payment gateways. Consequently, this bug can be reproduced with the following steps.

  1. Onboard a new site to WC. Enable some non-WooPayments payment methods.
  2. Install WooPayments, onboard site, and add some new payment methods in addition to the CC payment method.
  3. Visit checkout.
  4. You should see WooPayments CC as the top payment gateway, then the payment methods enabled in step 1, followed by the WooPayments payment methods enabled in step 2.

Actual behavior

This is the reproducible and inccorect ordering of payment gateways at checkout.

  • WooPayments CC
  • Other non-WooPayments PMs
  • Other WooPayments PMs

Screenshots

See above.

Expected behavior

The desirable order of payment gateways at checkout should be as follows.

  • WooPayments CC
  • Other WooPayments PMs
  • Other non-WooPayments PMs
@FangedParakeet FangedParakeet added focus: checkout payments type: bug The issue is a confirmed bug. labels Mar 3, 2025
@timur27 timur27 self-assigned this Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: checkout payments type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

2 participants