How to get Cart ID for a given customer in Shopify GraphQL API?

Ashwani
Shopify Partner
3 0 1

In GraphQL API, I looked all docs and references but I could not found any solution to access User's cart in GraphQL api.

 

Requesting your support to achieve User's cart detail in GraphQL api.

Replies 2 (2)

theaisyaaziz
Shopify Partner
14 1 6

When you say GraphQL API, is that Admin's or Storefront's? I don't think you'd be able to access the cart's detail in the Admin's GraphQL API, but you could get the cart detail from the Checkout UI Extension (I found this API: https://shopify.dev/docs/api/checkout-ui-extensions/unstable/apis/cart-lines) and send them via API to your backend. 

 

If you are unsure about the extension, I wrote a quick overview of what the Checkout UI Extension is here: https://liquidonate.com/blog/shopify-development-hacks-manipulating-cart-checkout

 

I didn't do it to get the cart details but it should be along the same line.

Ashwani
Shopify Partner
3 0 1

Thanks for your reply, I have fixed this issue using `cartLinesUpdate` mutation api.