Development discussions around Shopify APIs
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 |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023