Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Checkout Stock Validation Webhook

I did a search around the forum and couldn't find much info on validating cart quantities on checkout. The one post I did find, said that the best way would be to use the JavaScript API to validate the quantities using JSONP and stop the checkout if there are errors. This requires that the server we connect to is using SSL. Writing out the entire solution would also be more complicated than it has to be.

I think a better solution would be to have an optional endpoint on the store server where foxycart can send a validation request. This could be as simple as a JSON list of the cart contents and a requirement that the server returns an empty array or a list of error messages for the user. If the response is empty, it means there are no errors and the checkout proceeds as normal, otherwise, the user is sent back to the checkout page where they can see the error messages that were returned from the server.

This webhook request would happen on the server side of foxycart so SSL would not be required on the store server.
  • fc_adamfc_adam FoxyCart Team

    Thanks for the suggestion - we were actually just discussing a feature idea recently that is kind of inline with this. I'll add some notes to that ticket based on your thoughts here.

    The solution for now is as you described - you could hook into the checkout-submit event, and send off a request to a secure endpoint on your side with the current cart contents to validate if the user can still checkout with what they have or not. More details on the events at
Sign In or Register to comment.