Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
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?
Sidenote: Also tried to encode in base64 because I read that in another thread but it did not work either.
I managed to see the error. It says "invalid checkout id". So my assumption was correct. Any one here to help?
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.
Unfortunately not...I ended up changing my whole logic but adding a line item to an existing checkout mutation was not working for me.