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

Payment Request buttons visible for zero-amount checkout if coupon is appled on the checkout page #9687

Closed
dmvrtx opened this issue Nov 8, 2024 · 2 comments · Fixed by #9691
Assignees
Labels

Comments

@dmvrtx
Copy link
Contributor

dmvrtx commented Nov 8, 2024

Describe the bug

Express checkout buttons are shown for $0 checkouts. However, such amount is not supported by Stripe express checkout, leading to a lot of abandoned checkouts due to the Apple/Google pay button throwing errors when the checkout is $0.

This was fixed for block-based themes, but not for the shortcode ones, like StoreFront.

Related GH Issues:

To Reproduce

  • Create a simple product with a value of 20.
  • Create a coupon that will discount 20 and will enable free shipping.
  • Inside a Google Payments compatible browser, add the product to cart, and move to checkout.
  • The express checkout button will be rendered and functional.
  • Apply the discount, and that will make the checkout total 0.

Note

It is important that coupon is applied on the checkout page, when express payout buttons are already visible!

Actual behavior

Payment Request buttons, i.e. ApplePay, GooglePay and others, are visible.

Screenshots

Expected behavior

Payment Request buttons shouldn't be available.

@dmvrtx dmvrtx self-assigned this Nov 8, 2024
@dmvrtx
Copy link
Contributor Author

dmvrtx commented Nov 8, 2024

Update: After some testing (see notes below), I can reproduce this issue, with the caveat, that coupon code should be applied on the checkout page, once express checkout buttons are rendered.


I've been testing the steps locally and cannot reproduce the issue. I've tried three different options, both with develop and 8.4.0 branches:

  • Completely free product and shipping.
  • Non-free product with coupon for 100% discount and free shipping.
  • Non-free product with coupon for the exact amount and free shipping.

In all three cases express checkout buttons didn't appear on the cart and checkout pages, both block and shortcode versions.

Classic checkout Block checkout

Moreover, I didn't see any payment options suggested, and my suspicion is that WooCommerce handled the zero amount on its side, removing the need for the payment plugins to intervene.

If I remove the coupon, buttons appear as expected.

Classic checkout Block checkout

@dmvrtx dmvrtx changed the title Payment Request buttons visible for zero-amount cart on non-block based (shortcode) checkout Payment Request buttons visible for zero-amount checkout if coupon is appled on the checkout page Nov 8, 2024
@dmvrtx
Copy link
Contributor Author

dmvrtx commented Nov 8, 2024

The culprit is that for the checkout page WooPayments decides in class-wc-payments-payment-request-button-handler.php if it should show express checkout buttons or not, but this check happens once when page is loaded and is not re-evaluated when cart totals are updated. This seems to have other implications, e.g. payment request buttons won't appear if cart total goes from zero to any other value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants