curl --request POST \
--url 'https://api.example.com/api/cart/add' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"variantId": "string",
"quantity": 2,
"sessionId": "string"
}'
{
"checkoutUrl": "string"
}
Add a variant to the cart (optional)
For headless or cross-domain installs: proxies a Shopify Storefront cart mutation and returns checkoutUrl…
POST
/
api
/
cart
/
add
curl --request POST \
--url 'https://api.example.com/api/cart/add' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"variantId": "string",
"quantity": 2,
"sessionId": "string"
}'
{
"checkoutUrl": "string"
}
For headless or cross-domain installs: proxies a Shopify Storefront cart mutation and returns
checkoutUrl. Not needed when cartMode: 'shopify_ajax' lets the widget call Shopify’s /cart/add.js directly.
Request body
CartAdd
string
required
e.g.
gid://shopify/ProductVariant/123number
required
string
Response
CartAddResponse
string
Status codes
| Code | Meaning |
|---|---|
200 | OK |
400 | Error |
401 | Error |
curl --request POST \
--url 'https://api.example.com/api/cart/add' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"variantId": "string",
"quantity": 2,
"sessionId": "string"
}'
{
"checkoutUrl": "string"
}
Last modified on August 31, 2026