Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Add line item to existing checkout

Add line item to existing checkout

workFlo
Tourist
11 1 0

I want to add a product variant to the existing line items of my checkout. For now I am listening on the webhook "checkout created" which sends me information about the checkout (id etc.).

Now I want to use the checkoutLineItemsAdd mutation to add the product variant to the checkout. However, it does not work. It always returns me:

 

 

 

{ data: { checkoutLineItemsAdd: { checkout: null } } }

 

 

 


My assumption is that the checkoutId field is wrong. What I currently do is I take the token key and the key parameter from the "abandonded_checkout_url" property and concatenate the string like this:

 

 

 

 

{
checkoutId: 'gid://shopify/Checkout/[TOKEN_FROM_WEBHOOK]?key=[KEY_FROM_ABANDONED_CHECKOUT]
}

 

 

 

 
But I assume this is wrong. Anyone here knows how the format of the checkoutId looks like?

Replies 4 (4)

workFlo
Tourist
11 1 0

Sidenote: Also tried to encode in base64 because I read that in another thread but it did not work either.

workFlo
Tourist
11 1 0

I managed to see the error. It says "invalid checkout id". So my assumption was correct. Any one here to help? 

rajatabcx
Shopify Partner
1 0 0

did you find, any solution, I got the same error, but when the checkout is created through the mutation and then I try to addLineItem, it works. At this problem from last week, there is no solution, and the Shopify team is also not responding.

workFlo
Tourist
11 1 0

Unfortunately not...I ended up changing my whole logic but adding a line item to an existing checkout mutation was not working for me.