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

validateCouponCode does not fail promotions that do not pass the check method #3252

Open
mschipperheyn opened this issue Dec 1, 2024 · 1 comment

Comments

@mschipperheyn
Copy link
Collaborator

Describe the bug
I have a custom promotion that is according to validateCouponCode valid and therefore applied. However, the check method returns false. But since the the coupon is considered valid it's applied with a value of zero and shows up in the ui. That doesn't make sense to me.

Expected behavior
Coupons that fail the check method (return false) should return a CouponInvalidError so you can process the ui accordingly.

Environment (please complete the following information):

  • @vendure/core version: 3.0.8
  • Nodejs version
  • Database (mysql/postgres etc):
@michaelbromley
Copy link
Member

To me this would be mixing concerns: validateCouponCode is there to do just that: validate the coupon code. It should not then know about other conditions of the promotion.

However, I do understand why it might seem strange to apply a coupon which then results in no discount.

Can you give some more context around what type of condition logic is being used together with the coupon code?

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

No branches or pull requests

2 participants