Development discussions around Shopify APIs
Return management just got easier! We’ve launched Customer Self-Serve Returns to all Shopify merchants. Click here to learn more!
When using the graphql storefront api, I can create an empty checkout, but if I try to create a checkout with items, or add items to an existing checkout, the checkout comes back null.
This works:
mutation { checkoutCreate(input: {}) { checkout { id webUrl lineItems(first: 5) { edges { node { title quantity } } } } } }
which returns
{ "data": { "checkoutCreate": { "checkout": { "id": "Z2lkOi8vc2hvcGlmeS9DaGVja291dC80NGFkMzA1NzEyNmVjMTY0YzU0ODE0MGQ1OWU1ZjcyYj9rZXk9ZDNlNjRkNzU2ODg2NDdiNzJmNDViNzcwYjYyYWQ3MTM=", "webUrl": "https://knowyourh2o.myshopify.com/25164513346/checkouts/44ad3057126ec164c548140d59e5f72b?key=d3e64d75688647b72f45b770b62ad713", "lineItems": { "edges": [] } } } } }
But this fails:
mutation { checkoutCreate(input: { lineItems: [{ variantId: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zMjE0ODUzODYyMjAxOA==", quantity: 1 }] }) { checkout { id webUrl lineItems(first: 5) { edges { node { title quantity } } } } } }
which returns:
{ "data": { "checkoutCreate": { "checkout": null } } }
I can't for the life of me figure out what he issue is. The variantID is correct as verified by the below query to the admin by using the variantID:
query { node(id: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zMjE0ODUzODYyMjAxOA==") { ... on ProductVariant { id } } }
which returns:
{ "data": { "node": { "id": "gid://shopify/ProductVariant/32148538622018" } }, "extensions": { "cost": { "requestedQueryCost": 1, "actualQueryCost": 1, "throttleStatus": { "maximumAvailable": 1000, "currentlyAvailable": 999, "restoreRate": 50 } } } }
Can anyone point me in the right direction?
Thank you!
Solved! Go to the solution
This is an accepted solution.
Figured it out. Total newbie problem. The product was not yet made available to the sales channel.
This is an accepted solution.
Figured it out. Total newbie problem. The product was not yet made available to the sales channel.
Hi,
I'm experiencing the same issue. I thought all the products were in the sales channel. Is there a way to check which products could be missing?
DUDE!!!!!!!!!!!!!!!! After 10 hours, you saved my but.!!!!!! Also to any new people, make sure your on the latest api version. The docs dont reflect it.
User | RANK |
---|---|
16 | |
7 | |
6 | |
6 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022