Is it possible to retrieve an abandoned checkout found in https://.myshopify.com/admin/checkouts? I’m using Shopify’s JavaScript Buy SDK client.checkout.fetch(checkoutId) function to retrieve an abandoned checkout but it returns null.
If you have the checkout token and key, you can create the Storefront API ID by doing this:
const checkout_key = "aaeasdbr";
const checkout_token = "askdjkjdk";
const storefrontId = `gid://shopify/Checkout/${checkout_token}?key=${checkout_key}`;
const abandonedCheckout = client.checkout.fetch(storefrontId);
Yep, my problem is that
let checkoutId = window.btoa('gid://shopify/Checkout/181975d0fcfd563cdc24dcd63e3f38ad?key=7c14ae3f55dee33e73fd31e9bbf22d0c');
this.client.checkout.fetch(checkoutId).then((checkout) => {
console.log(checkout);
});
client.checkout.fetch() returns null. I’m using the checkout token and key found in https://.myshopify.com/admin/checkouts/<abandoned_checkout_id>.json in the ‘abandoned_checkout_url’ attribute. Are you getting the same functionality when retrieving a checkout from abandoned checkouts?
One thing that might be different:
I actually create my checkout with the same Storefront Token, as the one that I am using for fetch. If I try to use two different Storefront Tokens for creating the checkout, and fetching the checkout, it does not work.
yep, “Are you getting the same functionality when retrieving a checkout from abandoned checkouts?” via storefront API. Please refer to my question/topic of this thread so we don’t have a long thread filled with replies that don’t provide additional information.
I noticed you’re using this.client.checkout.fetch
Try removing this and just use client.checkout.fetch