[Storefront API] cartCreate raise error

api version : 2025-10 / 2025-07 / 2025-01 / 2026-01

{
  "errors": [
    {
      "message": "Field ‘warnings’ doesn’t exist on type ‘CartCreatePayload’",
      "locations": [
        {
          "line": 103,
          "column": 21
        }
      ],
      "path": [
        "mutation createCart",
        "cartCreate",
        "warnings"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "CartCreatePayload",
        "fieldName": "warnings"
      }
    }
  ]
}

Please share more information, e.g. the code of the mutation you’re trying to do.

@Luke This is a recent issue, as we just encounter this morning on 2025-10-31, on the 2025-01, 2025-10, Storefont cartCreate api –> cartCreate - Storefront API.

When ever we call this cartCreate Storefront api to create an empty cart, errors are being throw, saying certain fields does not exist, while on the official documentations, is there. Here is the returned errors;

{
    "errors": [
        {
            "message": "Field 'discountApplication' doesn't exist on type 'CartDiscountAllocation'",
            "locations": [
                {
                    "line": 40,
                    "column": 14
                }
            ],
            "path": [
                "mutation CreateCart",
                "cartCreate",
                "cart",
                "lines",
                "edges",
                "node",
                "discountAllocations",
                "discountApplication"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "CartDiscountAllocation",
                "fieldName": "discountApplication"
            }
        },
        {
            "message": "Field 'optionValues' doesn't exist on type 'ProductOption'",
            "locations": [
                {
                    "line": 100,
                    "column": 20
                }
            ],
            "path": [
                "mutation CreateCart",
                "cartCreate",
                "cart",
                "lines",
                "edges",
                "node",
                "merchandise",
                "... on ProductVariant",
                "product",
                "options",
                "optionValues"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "ProductOption",
                "fieldName": "optionValues"
            }
        },
        {
            "message": "Field 'preferences' doesn't exist on type 'CartBuyerIdentity'",
            "locations": [
                {
                    "line": 155,
                    "column": 8
                }
            ],
            "path": [
                "mutation CreateCart",
                "cartCreate",
                "cart",
                "buyerIdentity",
                "preferences"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "CartBuyerIdentity",
                "fieldName": "preferences"
            }
        },
        {
            "message": "Field 'warnings' doesn't exist on type 'CartCreatePayload'",
            "locations": [
                {
                    "line": 168,
                    "column": 8
                }
            ],
            "path": [
                "mutation CreateCart",
                "cartCreate",
                "warnings"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "CartCreatePayload",
                "fieldName": "warnings"
            }
        }
    ]
}

That return is base of this query we call on the cartCreate Storefront api


  mutation CreateCart($input: CartInput!) {
    cartCreate(input: $input) {
      cart {
        
    id
    checkoutUrl

    # Applied discount codes
    discountCodes {
      code
      applicable
    }

    # Line items with detailed product & pricing info
    lines(first: 100) {
      edges {
        node {
          id
          quantity

          # Cost for this line (quantity × unit price)
          cost {
            subtotalAmount {
              amount
              currencyCode
            }
            totalAmount {
              amount
              currencyCode
            }
          }

          # Any per-line discount allocations
          discountAllocations {
            discountedAmount {
              amount
              currencyCode
            }
            discountApplication {
              targetType
              value {
                ... on MoneyV2 {
                  amount
                  currencyCode
                }
                ... on PricingPercentageValue {
                  percentage
                }
              }
            }
          }

          # Custom attributes on the line
          attributes {
            key
            value
          }

          # The variant being purchased
          merchandise {
            ... on ProductVariant {
              id
              sku
              title

              # Unit price of the variant
              price {
                amount
                currencyCode
              }

              # Image
              image {
                url
                altText
              }

              # Weight & availability
              weight
              availableForSale

              # Selected options (e.g. Size, Color)
              selectedOptions {
                name
                value
              }

              # Parent product details
              product {
                id
                title
                handle
                vendor
                productType
                description
                options {
                  id
                  name
                  optionValues {
                    id
                    name
                  }
                }
              }
            }
          }
        }
      }
    }

    # Cart-level custom attributes
    attributes {
      key
      value
    }

    # Breakdown of cart costs
    cost {
      totalAmount {
        amount
        currencyCode
      }
      subtotalAmount {
        amount
        currencyCode
      }
      totalTaxAmount {
        amount
        currencyCode
      }
      totalDutyAmount {
        amount
        currencyCode
      }
    }

    # Buyer identity & preferences
    buyerIdentity {
      email
      phone
      countryCode

      deliveryAddressPreferences {
        ... on MailingAddress {
          address1
          address2
          city
          provinceCode
          countryCodeV2
          zip
        }
      }

      preferences {
        delivery {
          deliveryMethod
        }
      }
    }

      }
      userErrors {
        code
        field
        message
      }
      warnings {
        code
        message  
        target
      }
    }
  }
   

However, a similar issue is also happening on this one as well, cartLinesAdd - Storefront API. Returning same error about certain fields not doesn’t exist on certain type.

Did you try to add a Storefront-Access-Token to the request?

const response = await fetch(`https://${shop}/api/2025-07/graphql.json`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Shopify-Storefront-Access-Token': window.themeVariables.settings.storefrontToken,
  },
  body: JSON.stringify({ query: mutation, variables }),
});

We are using createStorefrontApiClient from ‘@shopify/storefront-api-client’. Passing the domain, token, etc.

In addition, by removing those fields mentioned in the errors return. Then the cartCreate and cartLineAdd Storefront api works as before. However, we do need to get the field data value of the “discountApplication”, so pls investigate on this issue. Thanks