Is there any way to get and update checkout by Shopify Storefront GraphQL

goldenphoenix
Tourist
4 0 2

I would like to know is there any way to fetch and update a checkout using Shopify Storefront GraphQL?

Note that: the checkout is created by the user using normal web flow on the storefront. It means the checkout is not created by GraphQL.

Let's consider this scenario:

  • The user visits the website and makes a checkout
  • The user abandoned the checkout.

From Shopify admin I can get the abandoned checkout URL: https: //mysite.com/1111111/checkouts/foo/recover?key=bar Based on this URL I make a GraphQL request by using Shopify js-buy-sdk:

 

const client = ShopifyBuy.buildClient({
     domain: 'mysite.myshopify.com',
     storefrontAccessToken: 'xxxxxx'
});

// I tried both base64 and raw string version
const checkoutId=`gid://shopify/Checkout/foo?key=bar`

client.checkout.fetch(checkoutId).then((checkout) => {
     console.log('checkout', checkout);
})

 

 

The server response null

Any help would be greatly appreciated. Many thanks!

Replies 0 (0)