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:
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.
- 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.
- 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-items,name,total-price
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?