Shopify Storefront Create Cart Example
Example of creating a shopping cart via the Shopify Storefront GraphQL API
Shopify Storefront Create Cart Example is an example object payload from Shopify Storefront API, with 4 top-level fields. It illustrates the shape of data this provider's APIs accept or return.
Top-level fields
Example Payload
{
"summary": "Create Cart Mutation - GraphQL Example",
"description": "Example of creating a shopping cart via the Shopify Storefront GraphQL API",
"request": {
"method": "POST",
"url": "https://mystore.myshopify.com/api/2024-10/graphql.json",
"headers": {
"X-Shopify-Storefront-Access-Token": "your-storefront-access-token",
"Content-Type": "application/json"
},
"body": {
"query": "mutation cartCreate($input: CartInput!) {\n cartCreate(input: $input) {\n cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n lines(first: 10) {\n edges {\n node {\n id\n quantity\n merchandise {\n ... on ProductVariant {\n id\n title\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}",
"variables": {
"input": {
"lines": [
{
"quantity": 2,
"merchandiseId": "gid://shopify/ProductVariant/808950810"
}
]
}
}
}
},
"response": {
"status": 200,
"body": {
"data": {
"cartCreate": {
"cart": {
"id": "gid://shopify/Cart/c1-a1b2c3d4e5f6",
"checkoutUrl": "https://mystore.myshopify.com/cart/c/a1b2c3d4e5f6",
"totalQuantity": 2,
"cost": {
"totalAmount": {
"amount": "59.98",
"currencyCode": "USD"
},
"subtotalAmount": {
"amount": "59.98",
"currencyCode": "USD"
}
},
"lines": {
"edges": [
{
"node": {
"id": "gid://shopify/CartLine/line-1",
"quantity": 2,
"merchandise": {
"id": "gid://shopify/ProductVariant/808950810",
"title": "Small / Blue",
"price": {
"amount": "29.99",
"currencyCode": "USD"
},
"product": {
"title": "Classic Cotton T-Shirt",
"handle": "classic-cotton-t-shirt"
}
}
}
}
]
}
},
"userErrors": []
}
}
}
}
}
Work with this as data
Every example here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for examples
4 MCP tools reach this
find_examplesBrowse and filter every example in the catalog.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.
Call it yourself
curl for this page
curl "https://apis.io/api/v1/examples/shopify-storefront-create-cart-example"
curl "https://apis.io/api/v1/examples?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.