Hi everyone,
I’m using the Shopify Storefront API to retrieve a cart by its ID, but the response doesn’t include the line items. Here’s the query I’m using:
query {
cart(
id: "gid://shopify/Cart/Z2NwLXVzLWV4YW1wbGU6MDEyMzQ1Njc4OTAxMjM0NTY3ODkw?key=examplekey1234567890"
) {
id
createdAt
updatedAt
lines(first: 10) {
edges {
node {
id
quantity
merchandise {
... on ProductVariant {
id
}
}
attributes {
key
value
}
}
}
}
attributes {
key
value
}
cost {
totalAmount {
amount
currencyCode
}
subtotalAmount {
amount
currencyCode
}
totalTaxAmount {
amount
currencyCode
}
totalDutyAmount {
amount
currencyCode
}
}
buyerIdentity {
email
phone
customer {
id
}
countryCode
deliveryAddressPreferences {
... on MailingAddress {
address1
address2
city
provinceCode
countryCodeV2
zip
}
}
preferences {
delivery {
deliveryMethod
}
}
}
}
}
Response. :
{
"lines": {
"pageInfo": {
"endCursor": null,
"hasNextPage": false
},
"edges": []
}
}
Even though I’ve added items to the cart, the lines array is empty or missing. I’ve verified that the cart ID is correct and that the items were added successfully.
Has anyone else faced this issue? Could this be a permission or scope problem, or am I missing something in the query?