The useCartLinesAddCallback hook returns a callback that can be used to add lines to a cart. If a cart doesn't already exist, then it will create the cart for you. It must be a descendent of a CartProvider component.

Example code

Return value

A callback to add new lines to a cart. The callback expects one argument that corresponds to the input you would provide to the Storefront API's cartLinesAdd mutation.