Error getting cart via API after product turns to draft

Error getting cart via API after product turns to draft

AdamKlein
Visitor
1 0 0

Hi,
We are using Shopify in headless mode. We are storing the user's cart ID in our DB and querying Shopify for it using the storefront API. We are not using Shopify customers.
We had a scenario where users added products to their cart, then we marked these products as draft in the admin console. We the users tried to get their cart using the same ID the API returned an error.

Can you please help us understand how we can overcome this situation? Why do we get back an error when requesting the cart?

BTW If we return the product to be active the cart response returns to work properly

Here are the request details:

Response:

 

{
 "error": [
  {
    "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 
       72127e61-b2d8-478d-850c-7c0813a74f36 (include this in support requests).",
    "extensions": {
      "code": "INTERNAL_SERVER_ERROR",
      "requestId": "72127e61-b2d8-478d-850c-7c0813a74f36"
     }
   }
 ]
}

 



Request:

 

`query ($cartId: ID!) {
cart(id: $cartId) {
id
estimatedCost {
totalAmount {
amount
}
}
lines(first:20) {
edges {
cursor
node {
id
quantity
merchandise {
...on ProductVariant {
id,
product {
id
title
handle
}
availableForSale
price
title
selectedOptions {
name
value
}
image {
src
}
sku
}
}
}
}
}
attributes {
key
value
}
}
}`

 

Variables:

 

{
  "cartId": "Z2lkOi8vc2hvcGlmeS9DYXJ0L2I5YmM2YzhmMmI4NTU2ZTFiYjRjYmFiMWU1MGUxYzk3"
}

 

 

Thanks

Reply 1 (1)

csam
Shopify Staff (Retired)
267 40 51

Hi @AdamKlein 

 

Thanks for letting us know about this. I would guess that this is occurring because the product in the cart wouldn't be available via the Storefront API when they are in draft status, but we'll look into this, and whether the error message itself is expected.

 

Regards,

To learn more visit the Shopify Help Center or the Community Blog.