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

addCartLineItems

Example Query
1mutation ExampleMutation($input: AddCartLineItemsInput) {
2 addCartLineItems(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 "cartEntityId": "example",
4 "data": {
5 "lineItems": [
6 {
7 "quantity": 0,
8 "productEntityId": 0,
9 "variantEntityId": 0,
10 "sku": "example",
11 "selectedOptions": {
12 "checkboxes": [
13 {
14 "optionEntityId": null,
15 "optionValueEntityId": null
16 }
17 ],
18 "dateFields": [
19 {
20 "optionEntityId": null,
21 "date": null
22 }
23 ],
24 "multiLineTextFields": [
25 {
26 "optionEntityId": null,
27 "text": null
28 }
29 ],
30 "multipleChoices": [
31 {
32 "optionEntityId": null,
33 "optionValueEntityId": null
34 }
35 ],
36 "numberFields": [
37 {
38 "optionEntityId": null,
39 "number": null
40 }
41 ],
42 "textFields": [
43 {
44 "optionEntityId": null,
45 "text": null
46 }
47 ]
48 }
49 }
50 ],
51 "giftCertificates": [
52 {
53 "name": "example",
54 "theme": "BIRTHDAY",
55 "amount": "BigDecimal",
56 "quantity": 0,
57 "sender": {
58 "name": "example",
59 "email": "example"
60 },
61 "recipient": {
62 "name": "example",
63 "email": "example"
64 },
65 "message": "example"
66 }
67 ]
68 },
69 "version": 0
70 }
71}
Example response
1{
2 "data": {
3 "addCartLineItems": {
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}

Adds line item(s) to the cart.

Was this page helpful?
Previous

deleteCart

Next

updateCartLineItem

Built with

Arguments

inputAddCartLineItemsInputRequired
Add cart line items input object

Returns

an optional AddCartLineItemsResult
cartCart
The Cart that is updated as a result of mutation.