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