How do I retrieve an existing checkout object using GraphQL?

James_Wanga
Tourist
7 0 1

I want o query for an existing checkout by the id returned when i created the checkout with "checkoutCreate" mutation. However I cant seem to find any documentation on how to do this. Is it possible?

0 Likes
James_Wanga
Tourist
7 0 1

I sorted it out.

 

 

{
  node(id: "Z2lkOi8v...") {
	id
	... on Checkout {
      id
      ready
      currencyCode
      subtotalPrice
      taxesIncluded
      totalTax
      totalPrice
      lineItems(first: 250) {
    	edges {
    		node {
    			id
    			title
    			quantity
    			variant {
    				id
    				price
    				image {
    					id,
    					transformedSrc
    				}
    			}
			}
    	}
      }
    }
  }
}



 

Tadeusz
Shopify Partner
1 0 0

Hey I am doing the same think but the reponse i get is : message"Invalid global id `12`. this is my query: any ideas what i am doing wrong?

 

query { 
    node(
        id: "test"
    ) {
        id
        ... on Checkout {
        id
        ready
        currencyCode
        subtotalPrice
        taxesIncluded
        totalTax
        totalPrice
        lineItems(first: 250) {
          edges {
            node {
              id
              title
              quantity
              variant {
                id
                price
                image {
                  id,
                  transformedSrc
                }
              }
            }
          }
        }
      }
    }
  }

 

0 Likes
KarlOffenberger
Shopify Partner
1867 182 803

That just means your checkout ID doesn't exist / is wrong. Double and triple check - the remainder of the query is okay.

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
0 Likes
vishalkumar
New Member
1 0 0

Can i retrieve items from existing checkout in the order they were added ?

currently i am getting items in random order using above query.

0 Likes
ObedPetmarkt
New Member
2 0 0

Hi James, on your checkout id what variable are you using as "key", the checkout id must be an b64 string compuse by a checkout gid

gid://shopify/Checkout/{ Checkout_token }?key={ key_value }"
0 Likes