Update discount codes
This guide shows you how to use a cart handler to apply discount codes to a cart.
RequirementsAnchor link to section titled "Requirements"
Step 1: Create a discount code formAnchor link to section titled "Step 1: Create a discount code form"
CartForm to create a discount code form. You can use this component anywhere in the app. It will submit a form request to the
/cart route's action when a visitor submits a discount code.
Step 2: Handle the discount code form requestAnchor link to section titled "Step 2: Handle the discount code form request"
Handle the discount code form request in an
action. Use the
cart, created from
createCartHandler, to handle cart mutation requests to the Storefront API.
- Learn how to apply selected delivery options.