Apply notes to carts
This guide shows you how to use a cart handler to apply a note to a cart. For example, you can enable users to apply a note that requests gift-wrapping.
Requirements
Anchor link to section titled "Requirements"- You've completed the quickstart guide.
- You've set up a cart handler.
Step 1: Create a cart note form
Anchor link to section titled "Step 1: Create a cart note form"Use the CartForm
component to create a cart note form. The component submits a form request to the /cart
route's action when users submit an update to the note. You can use this component anywhere in the app.
Step 2: Handle the cart note form request
Anchor link to section titled "Step 2: Handle the cart note form request"Handle the cart note form request in an action
. Use the cart
, created from createCartHandler
, to handle cart mutation requests to the Storefront API.
- Learn how to apply cart attributes.