-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Better error messages when coupons are stuck in a pending order. #28592
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
Conversation
We hold coupons when payment is failed if the setting "hold stock for checkout" is enabled for some minutes. This is to allow the customers to try again if they want, and to give time to complete payment for gateways where it could take some time. Unfortunately this cause for some bad UX user retries by starting the order from scratch again, and then if they apply the coupon, usage limit gets hit because the earlier coupon is still held and is counted towards the usage. This commit improves the error message in these cases when usage is applied per customer and is hit, by stating to go to my account to complete/cancel payment (in case of logged in user) or to wait for some time in case of guest users.
Earlier, we were just showing an "Usage limit reached message", however in some cases, specially when user is logged in, we can also ask them to go to MyAccount page and cancel order if they'd like to (to free up the coupon). This will hopefully make for a better user experience.
This also removes some cart operations which are not needed anymore to since cart already has items that we were adding in those tests.
roykho
left a comment
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.
Left a comment on coding standards. Besides that I think in general it tested well however if you try to checkout again with valid payment after 1st fail, you will get this message
This message could be misleading as the coupon is currently just locked to their pending order. Perhaps we should add the same message to go to their my account to cancel the order to reinstate this coupon? This way it is more consistent?
The other thing I noticed was that the Travis CI is failing on the e2e tests but I don't think it is related to this PR.
@roykho Looks like this is coming via https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-cart.php#L726, which is basically eating up all the coupon error messages. I'd rather target this in a different PR targeted to next release instead of this one since it will affect all error messages instead of just this one case. And so will need more robust testing and tests as well. Do you think if its fine to target refactoring that method in a different PR? |
Ok that's fine. |
roykho
left a comment
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.
Approving this and a separate issue will be opened for the error message by author.
|
Closing the loop: #28641 |
We hold coupons when payment is failed if the setting "hold stock for checkout" is enabled for some minutes. This is to allow the customers to try again if they want, and to give time to complete payment for gateways where it could take some time.
Unfortunately this cause for some bad UX user retries by starting the order from scratch again, and then if they apply the coupon, usage limit gets hit because the earlier coupon is still held and is counted towards the usage. This PR improves the error message in these cases when usage is applied per customer and is hit, by stating to go to my account to complete/cancel payment (in case of logged in user) or to wait for some time in case of guest users.
All Submissions:
Changes proposed in this Pull Request:
Closes #27673.
How to test the changes in this Pull Request:
(While logged in to an account)
(As a guest)
Other information:
Changelog entry