Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Retrieve a cart using Storefront API

Retrieve a cart using Storefront API

prashants6
New Member
9 0 0

Hi, I am trying to retrieve a cart by its ID using below mentioned API:

https://shopify.dev/custom-storefronts/cart#retrieve-a-cart

This is how I am trying to access it using postman. But below is the error I am getting. AA.png

Replies 3 (3)

prashants6
New Member
9 0 0

Please let me know if I am making any mistake here.

tiepbuijmvn
Shopify Partner
6 0 0

Hi,

You can simple query your cart by cartId as following:

{
  node(id:"YOUR_CART_AND_ALSO_YOUR_CHECKOUT_ID"){
    id
    ...on Checkout{
      id
      currencyCode
      createdAt
    	totalPriceV2{
        amount
      }
    }
  }
}

Of course, you can specify which field you would like to retrieve into the query.

Regards.

BST
tiepbuijmvn
Shopify Partner
6 0 0

 And I think the problem is that you have not defined the query for your retrieving request in the "QUERY" section.

BST