Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate and present custom error for not in allowed emails coupons (#…
…43872) * Removed deprecated WC_COUPON::is_valid() method usage from CartController.php * Reverted wrongly changed line. * Added validate_coupon_allowed_emails() to WC_Discounts * Added soft validation for allowed emails coupons, with custom notice via WC_Coupon::add_coupon_message() * Fixed log warning * Refactored add_coupon_message() * Prevent duplicate coupon notices. * Changed coupon soft validation notice type. * Tweaks * Run coupon soft validations only on cart validation. * Reverted soft validation, and added email information for coupon validation * Removed unused coupon message * PHP lint fixes. * Added changelog. * PHP lint fix * Updated allowed coupon validation error message * Updated PW tests * Updated PW tests * Updated email restricted coupon message. * Small change for readability. * Different error messages for shortcode cart and shortcode checkout * Simplified CartApplyCoupon::get_post_route_response() * Revert "Simplified CartApplyCoupon::get_post_route_response()" This reverts commit 43f185b. * Expose additional error data in error API response * Simplified AbstractCartRoute::get_route_error_response() * Linting * Restored comment deleted by mistake. * Introduced API context based coupon errors * Fixed Doc Block * Linting * Reverted deprecated method removal * Reverted deprecated method removal * WIP * Display context based errors on cart and checkout for allowed emails coupons. * Small code fixes. * Removed coupon_error_code from api response. * Tweaks and used 'details' on the API response * Fixed indent. * Set coupon errors using the validation store rather than local state * Revert import to original state. * Updated tests. * Updated tests. * Simplified comments * Added testing for Cart page * Lint fixes --------- Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
- Loading branch information
1 parent
211d39d
commit 0a3cf74
Showing
10 changed files
with
205 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
plugins/woocommerce/changelog/26289-validate-coupon-allowed-emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: enhancement | ||
|
||
Validate coupons with email restrictions upfront and change user's feedback when a coupon is not valid for the user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.