For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • About Our APIs
  • REST
    • Overview
  • GraphQL
    • Overview
      • Playground
      • Explorer
          • MUTcreateCart
          • MUTdeleteCart
          • MUTaddCartLineItems
          • MUTupdateCartLineItem
          • MUTdeleteCartLineItem
          • MUTupdateCartCurrency
          • MUTassignCartToCustomer
          • MUTunassignCartFromCustomer
          • MUTcreateCartMetafield
          • MUTupdateCartMetafield
          • MUTdeleteCartMetafield
          • MUTcreateCartRedirectUrls
          • MUTcreateCheckout
          • MUTupdateCheckout
          • MUTaddCheckoutBillingAddress
          • MUTupdateCheckoutBillingAddress
          • MUTupdateCheckoutCustomerMessage
          • MUTselectCheckoutShippingOption
          • MUTapplyCheckoutCoupon
          • MUTunapplyCheckoutCoupon
          • MUTapplyCheckoutGiftCertificate
          • MUTunapplyCheckoutGiftCertificate
          • MUTapplyCheckoutSpamProtection
          • MUTaddCheckoutShippingConsignments
          • MUTupdateCheckoutShippingConsignment
          • MUTdeleteCheckoutConsignment
          • MUTcompleteCheckout
          • MUTlogin
          • MUTlogout
          • MUTcreateWishlist
          • MUTaddWishlistItems
          • MUTdeleteWishlistItems
          • MUTupdateWishlist
          • MUTdeleteWishlists
          • MUTloginWithCustomerLoginJwt
          • MUTsubmitContactUs
          • MUTgenerateSessionSyncJwt
          • MUTvalidateSessionSyncJwt
          • MUTproductViewedEvent
          • MUTpageViewedEvent
          • MUTvisitStartedEvent
          • MUTsearchProductEvent
          • MUTpreviewGiftCertificate
          • MUTregisterCompany
          • MUTaddProductReview
          • MUTchangePassword
          • MUTrequestResetPassword
          • MUTresetPassword
          • MUTregisterCustomer
          • MUTupdateCustomer
          • MUTaddCustomerAddress
          • MUTupdateCustomerAddress
          • MUTdeleteCustomerAddress
          • MUTpayment
          • MUTsubscribe
          • MUTunsubscribe
  • MCP
    • Overview
Dev Portal
LogoLogo
GraphQLStorefrontMutations

createCart

Example Query
1mutation ExampleMutation($input: CreateCartInput) {
2 createCart(input: $input) {
3 cart {
4 id
5 entityId
6 currencyCode
7 displayCurrencyCode
8 isTaxIncluded
9 baseAmount
10 baseAmountInDisplayCurrency
11 discountedAmount
12 discountedAmountInDisplayCurrency
13 amount
14 }
15 }
16}
Variables
1{
2 "input": {
3 "lineItems": [
4 {
5 "quantity": 0,
6 "productEntityId": 0,
7 "variantEntityId": 0,
8 "sku": "example",
9 "selectedOptions": {
10 "checkboxes": [
11 {
12 "optionEntityId": 0,
13 "optionValueEntityId": 0
14 }
15 ],
16 "dateFields": [
17 {
18 "optionEntityId": 0,
19 "date": "DateTime"
20 }
21 ],
22 "multiLineTextFields": [
23 {
24 "optionEntityId": 0,
25 "text": "example"
26 }
27 ],
28 "multipleChoices": [
29 {
30 "optionEntityId": 0,
31 "optionValueEntityId": 0
32 }
33 ],
34 "numberFields": [
35 {
36 "optionEntityId": 0,
37 "number": 0
38 }
39 ],
40 "textFields": [
41 {
42 "optionEntityId": 0,
43 "text": "example"
44 }
45 ]
46 }
47 }
48 ],
49 "giftCertificates": [
50 {
51 "name": "example",
52 "theme": "BIRTHDAY",
53 "amount": "BigDecimal",
54 "quantity": 0,
55 "sender": {
56 "name": "example",
57 "email": "example"
58 },
59 "recipient": {
60 "name": "example",
61 "email": "example"
62 },
63 "message": "example"
64 }
65 ],
66 "currencyCode": "example",
67 "locale": "example"
68 }
69}
Example response
1{
2 "data": {
3 "createCart": {
4 "cart": {
5 "id": "example",
6 "entityId": "example",
7 "currencyCode": "example",
8 "displayCurrencyCode": "example",
9 "isTaxIncluded": true,
10 "baseAmount": {
11 "currencyCode": null,
12 "value": null,
13 "formatted": null,
14 "formattedV2": null
15 },
16 "baseAmountInDisplayCurrency": {
17 "currencyCode": null,
18 "value": null,
19 "formatted": null,
20 "formattedV2": null
21 },
22 "discountedAmount": {
23 "currencyCode": null,
24 "value": null,
25 "formatted": null,
26 "formattedV2": null
27 },
28 "discountedAmountInDisplayCurrency": {
29 "currencyCode": null,
30 "value": null,
31 "formatted": null,
32 "formattedV2": null
33 },
34 "amount": {
35 "currencyCode": null,
36 "value": null,
37 "formatted": null,
38 "formattedV2": null
39 }
40 }
41 }
42 }
43}
Creates a cart and generates a cart ID.
Was this page helpful?
Previous

countries

Next

deleteCart

Built with

Arguments

inputCreateCartInputRequired
Create cart input object

Returns

an optional CreateCartResult
cartCart
The Cart that is created as a result of mutation.