Using the Storefront API and looking for some help retrieving a checkout that has been created (for example: via checkoutCreate) and not yet turned into an order.
The use case is that we’re wanting to create a Cart page on a website. When the customer goes to the Cart page, as long as we have a Checkout ID in their session, we retrieve the Checkout and show the line items in the cart.
Here’s the query we’re using:
{
node(id: “Z2lkOi8vc2hvcGlmeS9DaG…”) {
id
… on Checkout {
id
ready
currencyCode
subtotalPrice
taxesIncluded
totalTax
totalPrice
lineItems(first: 250) {
edges {
node {
id
title
quantity
variant {
id
price
}
}
}
}
}
}
}
We’re getting the following error back from the API:
{
“errors”: [
{
“message”: “Unexpected end of document”,
“locations”:
}
]
}
Any tips on how to successfully pull a Checkout back using the Checkout ID? Has anyone had any luck doing this on the 2019-10 version of the Storefront API? This doesn’t seem to be well documented…
I tried your query, and although it’s using a bunch of deprecated parameters the syntax is fine and this should work. The error message you are getting leads me to believe it’s not an issue with the query itself but how you are sending it in code. It’s possible you are sending the query with some extra whitespace or characters. Can you try the same query in a client such as insomnia or postman and see if you get the same results? If so, can you pass along some more details so I can look it up on my end, most helpful is the X-Request-ID returned in the headers after you call the API.
I’m doing your exact query except with my checkout id, of course, and I keep getting the error: “No such type Checkout, so it can’t be a fragment condition” I’ve googled a bunch and can’t find a thing. Do you have any ideas?