Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Get additional information on line items on abandoned checkouts

Get additional information on line items on abandoned checkouts

YauhenV
Shopify Partner
2 0 0

An unregistered customer adds an order to the cart and moves to checkout, after which he leaves this page. We want to get information from this checkout (LineItems with custom properties), knowing only the checkout id stored in the link, for example https://myshop.com/checkouts/c/c19cdd0166046125965b33b3913f576a (where c19cdd0166046125965b33b3913f576a is checkout id).
Currently, we have tried several methods:
1. Request from https://shopify.dev/docs/api/admin-rest/2024-04/resources/checkout#get-checkouts-token

curl -X GET -H “X-Shopify-Access-Token: app_access_token” -H “Content-Type: application/json” https://myshop.myshopify.com/admin/api/2024-04/checkouts/c19cdd0166046125965b33b3913f576a.json

For this request, we receive an error [API] This action requires merchant approval for `read_checkouts` scope. Based on the documentation, we need to convert the application to a Sales channel app, but we do not want to change the sales flow for our store.

2. Query via GraphQL Storefront API in Shopify GraphiQL App:

{
   node(id: “gid://shopify/Checkout/c19cdd0166046125965b33b3913f576a”) {
     ... on Checkout {
       id
       lineItems {
         nodes {
           customAttributes {
             key
             value
           }
           title
           unitPrice {
             amount
             currencyCode
           }
           variant {
             sku
             title
           }
         }
       }
     }
   }
}

In response, We received

{
   “data”: {
     “node”: null
   }
}

Which means (I think, not sure) that no data was found for this node.

3. Request via GraphQL AdminAPI Shopify GraphiQL App for request

query MyQuery {
   order(id: “gid://shopify/Order/c19cdd0166046125965b33b3913f576a”) {
     lineItems(first: 10) {
       nodes {
         customAttributes {
           key
           value
         }
       }
     }
   }
}

We get the error `Access denied for order field. Required access: read_orders access scope, read_marketplace_orders access scope or read_buyer_membership_orders access scope`. At the same time, we issued `read_orders` access for the Shopify GraphiQL App.
4. Request from https://shopify.dev/docs/api/admin-rest/2024-04/resources/order#get-orders-order-id?fields=id,line-i...

curl -X GET “https://myshop.myshopify.com/admin/api/2024-04/orders/c19cdd0166046125965b33b3913f576a.json?fields=line_items%2Cname%2Ctotal_price” -H “X-Shopify-Access-Token: private_token”

We get the error

{“errors”:{“id”:“expected String to be a id”}}

 

So, Is it even possible to get data about LineItems from the abandoned checkout of an unregistered user? And if so, how can this be done?

Replies 0 (0)