Skip to main content
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

items
array
required
Array of items to add

Shorthand Format

You can also use the shorthand format for adding a single item (no items 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:
id
integer
Variant ID of the item that was added (used by cart-notification scripts)
key
string
Line item key of the added/merged line
items_changelog
object
{ added: [{ id, quantity }], removed: [] } describing the change

Example 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:
A non-AJAX browser form submission is redirected to /cart (HTTP 302) instead of receiving a JSON body.