cart Createmutation
mutation
2024-07
Creates a new cart.
Arguments
The fields used to create a cart.
Was this section helpful?
CartCreatePayload returns
The new cart.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Hide code
Mutation reference
Copy
mutation cartCreate { cartCreate { cart { # Cart fields } userErrors { field message } } }
Hide code
Input
Copy
{ "input": { "attributes": [ { "key": "<your-key>", "value": "<your-value>" } ], "buyerIdentity": { "companyLocationId": "gid://shopify/<objectName>/10079785100", "countryCode": "AC", "customerAccessToken": "<your-customerAccessToken>", "deliveryAddressPreferences": [ { "customerAddressId": "gid://shopify/<objectName>/10079785100", "deliveryAddress": { "address1": "<your-address1>", "address2": "<your-address2>", "city": "<your-city>", "company": "<your-company>", "country": "<your-country>", "firstName": "<your-firstName>", "lastName": "<your-lastName>", "phone": "<your-phone>", "province": "<your-province>", "zip": "<your-zip>" }, "deliveryAddressValidationStrategy": "COUNTRY_CODE_ONLY", "oneTimeUse": true } ], "email": "<your-email>", "phone": "<your-phone>", "preferences": { "delivery": { "coordinates": { "countryCode": "AC", "latitude": 1.1, "longitude": 1.1 }, "deliveryMethod": [ "PICKUP_POINT" ], "pickupHandle": [ "<your-pickupHandle>" ] }, "wallet": [ "<your-wallet>" ] } }, "discountCodes": [ "<your-discountCodes>" ], "giftCardCodes": [ "<your-giftCardCodes>" ], "lines": [ { "attributes": [ { "key": "<your-key>", "value": "<your-value>" } ], "merchandiseId": "gid://shopify/<objectName>/10079785100", "quantity": 1, "sellingPlanId": "gid://shopify/<objectName>/10079785100" } ], "metafields": [ { "key": "<your-key>", "type": "<your-type>", "value": "<your-value>" } ], "note": "<your-note>" } }
input CartInput { attributes: [AttributeInput!] buyerIdentity: CartBuyerIdentityInput discountCodes: [String!] giftCardCodes: [String!] lines: [CartLineInput!] metafields: [CartInputMetafieldInput!] note: String } input AttributeInput { key: String! value: String! } input CartBuyerIdentityInput { companyLocationId: ID countryCode: CountryCode customerAccessToken: String deliveryAddressPreferences: [DeliveryAddressInput!] email: String phone: String preferences: CartPreferencesInput } input CartLineInput { attributes: [AttributeInput!] merchandiseId: ID! quantity: Int sellingPlanId: ID } input CartInputMetafieldInput { key: String! type: String! value: String! }