-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Bug]: Wrong promotion code is not triggering request error #11177
Comments
Can you add details about the payload of the two requests? That would be helpful. In any case, though, we don't throw a 404 on non-existing promotion codes. We just apply it if it exists, and otherwise, leave the cart in its current state. Happy to help with the unexpected behavior of the SDK vs. Postman, but I'll be closing this issue as the 200 code is expected. |
Ahh okay, thank you for your replay. So we should handle wrong promotion codes manually on frontend, or there is some other way of doing it? With sdk:
With HTTP request - postman: |
The difference in behavior comes from the fact that in the Next.js starter we append the new code to the already applied codes when sending the request. |
Our company policy is that we will support only one promotion code, I have used your starter Next.js code in some cases but also i had to rework some minor parts. Also one more question, on your store example, you have this wrong promotion code logic working. I was just confused because this is working on example but not on starter, also there are some other parts that are not working on starter code but works on your live example, like search. It would be nice if your example page code could be public, I know I would love it, I'm sure other devs would too :) Anyhow thank you once again on info about promotion codes. |
Package.json file
Node.js version
20.9.0
Database and its version
PostgresSQL 16
Operating system name and version
Pop!_OS 22.04 LTS
Browser name
No response
What happended?
I'm working on a eCom project and I came along on issue with promo codes. Issue is that I can not get an "error" on entering wrong promo code, instead every response is 200 from the admin part.
With medusa SDK on storefront, application is behaving like:
With standard HTTP request using postman:
Expected behavior
On entering non-existing promotion code API response should be 404.
Actual behavior
With medusa SDK on storefront, application is behaving like:
With standard HTTP request using postman:
Link to reproduction repo
repo is private
The text was updated successfully, but these errors were encountered: