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
Validate and present custom error for not in allowed emails coupons #43872
Validate and present custom error for not in allowed emails coupons #43872
Conversation
Test Results SummaryCommit SHA: 018c790
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
…nt-work-as-expected
…nt-work-as-expected
…nt-work-as-expected
…via WC_Coupon::add_coupon_message()
…nt-work-as-expected
…nt-work-as-expected
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.
Thanks for working on this, @wavvves. While reviewing it, I noticed the cart-related error message on the checkout shortcode page. I left a comment for that. Apart from that, the PR is working as expected. I just mentioned a few nitpicks to potentially improve the readability, and I left a comment regarding extending the test cases to cover all affected pages (cart and checkout blocks and shortcodes).
plugins/woocommerce-blocks/assets/js/base/context/hooks/cart/use-store-cart-coupons.ts
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-restricted-coupons.spec.js
Outdated
Show resolved
Hide resolved
…nt-work-as-expected
…nt-work-as-expected
…nt-work-as-expected
…nt-work-as-expected
…nt-work-as-expected
…nt-work-as-expected
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.
I've successfully tested this PR, @wavvves. Thanks for this improvement. 🙌
Submission Review Guidelines:
Changes proposed in this Pull Request:
This PR introduces upfront validation in allowed emails coupons, opposed to the current procedure of adding the coupons and removing them when placing the Order if the billing email does not match the coupon whitelist of emails.
It also updates the error messages presented to the user, stating clearly why the coupon was not accepted and how to proceed to use it effectively.
Closes #26289
Closes #26305
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Prior to testing
Shortcode Cart Test
Blocks Cart test
Shortcode Checkout test
Blocks Checkout test
Changelog entry
Significance
Type
Message
Comment