I’m trying to figure which logic is used to set line item values for shopware cart to solve the following problem, I have injected a dynamic form in the PDP and created a promise based function that creates a serializable JSON object from the filled form data, I would like to attach this JSON object to the cart items conditionally. So… Where can I find the logic responsible for resolving cart items addition?
It depends on what you want to do.
You can use the Storefront CartLineItemController to add a LineItem to the cart.
Or in JS you can use the store-api-client.service
to add a LineItem using the route /store-api/checkout/cart/line-item
, see CartItemAddRoute
.