I have created a widget that sits inside the product page which allows the customization of a complex product type. From this widget, I would like to add the finished product into the cart. Looking at the documentation there appears to be a way of doing this through the Storefront API (CheckoutLineItemInput). But how it is actually implemented is still confusing to me.
There is another GraphQL endpoint similarly called checkoutLineItemsAdd with a different spec entirely.
I am able to make other GraphQL calls, could someone please help me figure out what the call would look like to add an item to the cart for a given product (or variant) id?
Thanks so much!
The input you shared is for use with the Sales Channel SDK, so I don't believe that is what you're looking for.
Have you investigated the JS Buy SDK at all? I believe this is what you're looking for. Specifically, creating a checkout.
Alternatively, you could customize the actual add to cart button on the storefront to add your customized product. Assuming you're customizing the item by adding line item properties, our doc on adding customizations to a line item might be worth checking out.
|an hour ago|