1 year ago
#376668
Duannx
Get and update checkout by Shopify Storefront GraphQL
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!
graphql
shopify
shopify-app
shopify-api
0 Answers
Your Answer