Add to Cart
Cart
Add to Cart
Add an item to the cart
POST
Add to Cart
Add to Cart
Adds one or more items to the cart.Add-to-cart is a storefront surface, not part of the OAuth
/api/v1 app
API. It follows the Shopify-AJAX cart contract: requests are made against the
storefront origin (your store domain), identity is the cart cookie token
(not a Bearer access token), and the response is the flat Shopify cart
object — not wrapped in a { status, type, data } envelope. The endpoint
accepts JSON, multipart/form-data, and application/x-www-form-urlencoded
bodies.Request
Body Parameters
Array of items to add
Shorthand Format
You can also use the shorthand format for adding a single item (noitems
wrapper):
Response
The response is the flat Shopify cart object (the same shape returned by Get Cart), reflecting the updated cart after the add. For theme JavaScript, three extra top-level fields are included:Variant ID of the item that was added (used by cart-notification scripts)
Line item key of the added/merged line
{ added: [{ id, quantity }], removed: [] } describing the changeExample Response
Adding Items with Properties
Add personalized items with custom properties:Errors
On failure (e.g. variant out of stock) the endpoint returns a Shopify-style error body with the real HTTP status:/cart (HTTP 302)
instead of receiving a JSON body.