Ways to throw custom error messages #247
tommypepsi
started this conversation in
Feedback: Cart and Checkout Validation API
Replies: 1 comment 2 replies
-
Hey @tommypepsi
That error is only shown when a function crashes while running. If you see that message while running the function in your dev store, you should be able to go check your extension in Partners and see what kind of exception made the function fail. We already support outputting errors from functions, like in this example. Happy to hear suggestions for improvements, if the documentation was hard to find/confusing. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When adding the cart validation rule, the user has the choice to block the checkout or let it continue in case of errors. The error is really generic and just tells the customer to contact the store owner. I'm pretty sure this will cause a lot of confusion as there is no indication as to what might be causing this error.
One thing I would like to be able to do is throw an error with a customized error message (that would show in the checkout) that would also respect the choice of the merchant to block the checkout or not.
An example is our app depends on data from the frontend to be passed to the order attributes, if this information is missing (due to the app failing) I would like to block the checkout if this was the choice of the merchant when he added the rule or continue if not.
I thought of two possible ways for that:
I'm guessing we would need to define a specific way to throw the error to not show unwanted error message to the front end.
I'm guessing we could add an option within our app with a metafield for this but since the merchant is already making this choice when adding the rule I think it would be redundant to ask this again.
Beta Was this translation helpful? Give feedback.
All reactions