-
Notifications
You must be signed in to change notification settings - Fork 69
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
Introduce express checkout utilities class #7926
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.27 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great to see this area being incrementally improved, I remember some time ago we chatted in another GH issue on this. Great job @mdmoore! All the testing instructions are passing and shipping zone hint in the description (to reproduce the bug on develop
) was super helpful ⚡
I'm leaving a few comments which shouldn't block the PR 👍
Unrelated to this PR
I've noticed that when not changing a discounted product count and going through the GPay flow, the original price is being shown and not the reduced price. I can reproduce it in develop
and after a quick search in the backlog I want to create a new issue for this, but before I do this: may I ask you to quickly check if I'm right or not? Thank you!
includes/express-checkout/class-wc-payments-express-checkout-button-utils.php
Outdated
Show resolved
Hide resolved
includes/express-checkout/class-wc-payments-express-checkout-button-utils.php
Outdated
Show resolved
Hide resolved
includes/express-checkout/class-wc-payments-express-checkout-button-utils.php
Outdated
Show resolved
Hide resolved
Thanks @timur27!
Can you describe how you're discounting your product? I've tried by adding a sale price and via coupon code add on the cart page(which is not applied to express checkout) and the discounted price is reflected in the total. I'm happy to test further and help confirm this bug. |
Fixes #7694
Fixes #7801
Changes proposed in this Pull Request
This introduces a utility class for express checkout buttons such as the payment request buttons and WooPay buttons. There are several duplicated functions across the WooPay and Payment Request button handler class. The impetus for this refactor was the bug mentioned in #7588. Both express buttons are using the
wc_ajax_wcpay_add_to_cart
hook with an attachedajax_add_to_cart
function. This leads to conflicts when both button types are enabled at the same time, with the WooPaywc_ajax_wcpay_add_to_cart
always being called. This PR moves that hook to a single location and calls a singlewc_ajax_wcpay_add_to_cart
function from a utilities class.This will also serve as a good base to consolidate other duplicated functions among the two button handler classes as mentioned in 1545-gh-Automattic/woopay.
Testing instructions
develop
branch, enable WooPay and Payment Request buttons.wc-ajax=wcpay_add_to_cart
andwc-ajax=wcpay_get_shipping_options
responses.I remember having trouble reproducing this initially due my my shipping setup. As long as you're triggering a shipping zone/method with an address stored in Google, the issue should be present. I'm using a flat rate of $1.
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge