通过 Shopify Storefront GraphQL 获取和更新结账
我想知道有什么方法可以使用Shopify StoreFront GraphQl获取和更新结帐?
请注意:结帐是由用户使用店面上的普通Web流创建的。这意味着结帐不是由GraphQl创建的。
让我们考虑以下情况:
- 用户访问网站并进行结帐,
- 用户放弃了结帐。
从Shopify Admin我可以获取废弃的结帐URL:https://mysite.com/111111/checkouts/foo/recover?keykekey=bar
基于此URL,我通过使用shopify js-buy-sdk做出GraphQl请求:
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);
})
服务器响应null
。
任何帮助将不胜感激。非常感谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论