====== The Pre-Cart Webhook ====== This is advanced functionality and is currently only available on our Advanced and Enterprise plans. Please contact us for additional details. ===== What is the Pre-Cart Webhook? ===== The pre-cart webhook is an advanced feature (which may only be available on certain Foxy plans) that allows you to intercept the "add to cart" requests to ''/cart''. You can then completely intercept, modify, ignore, or pass through the request back to Foxy. ==== Examples and Use Cases ==== * Custom discounting or promotions, with complex logic our coupons or gift cards can't support. * Using an external system to control the cart itself, and/or check licensing or availability before allowing a customer to add the product to the cart. * Using an external system to create cart details on cart-add. So instead of defining the product like normal, in the GET or POST data, you'd pass through something like ''/cart?isbn=9780809590469''. The response from this webhook would define the product as desired. ===== Technical Notes ===== ==== Known Limitations ==== * Externally-controlled coupons: There is currently a limit of one externally-controlled coupon per store (which isn't generally an issue), and one externally-controlled code per transaction (which //may// be an issue). ==== Common Errors ==== * **Errors about "cart id is 0":** If you PATCH to a cart ID of 0, you'll get this error.