Shopify function input query got 'input_query_validation_error'

AI-generated summary

Deployment of a Shopify Function fails during “shopify deploy” with input_query_validation_error, specifically: “Field ‘attributes’ doesn’t exist on type ‘Cart’ at ‘query Input.cart.attributes’.”

The input.graphql query includes:

  • discountNode.metafield(namespace: “order-discount”, key: “percentage”).
  • cart fields: cost.totalAmount.amount, attributes.extra_credit, and lines with quantity and merchandise (ProductVariant id).

The poster references Shopify Order Discounts documentation indicating Cart supports attributes and provides the official link.

No resolution or workaround is offered, and no configuration details or version info are provided. The discussion remains open with the central question: why Cart.attributes is rejected by the input schema validator despite documentation suggesting its availability.

A code snippet is central to understanding the issue; no images or other attachments are involved.

extension/xxx/input.graphql

query Input {
  discountNode {
    metafield(namespace: "order-discount", key: "percentage") {
      value
    }
  }
  cart {
    cost {
      totalAmount{
        amount
      }
    }
    attributes {
      extra_credit
    }
    lines {
      quantity
      merchandise {
        ...on ProductVariant {
          id
        }
      }
    }
  }
}

when excute shpoify deploy,got the error

The deployment of functions failed with the following errors:
    [
      {
        "field": null,
        "message": "Field 'attributes' doesn't exist on type 'Cart' at 'query Input.cart.attributes'",
        "tag": "input_query_validation_error"
      }
    ]

but dev doc show that attributes is in cart
https://shopify.dev/api/functions/reference/order-discounts/graphql/common-objects/cart