Using Storefront API to retrieve Abandoned CheckOut

NAVEKI
Shopify Partner
14 0 2

Is it possible to retrieve an abandoned checkout found in https://<shop>.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.

tolgapaksoy
Shopify Partner
67 5 33

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);
0 Likes
NAVEKI
Shopify Partner
14 0 2

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://<shop>.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?

0 Likes
tolgapaksoy
Shopify Partner
67 5 33

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.

0 Likes
NAVEKI
Shopify Partner
14 0 2

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.

0 Likes
michaeltheodore
Explorer
59 6 8

I noticed you're using this.client.checkout.fetch

Try removing this and just use client.checkout.fetch

0 Likes