Search code examples
symfonyshopwareshopware6shopware6-api

How does shopware set values for line items


I'm trying to figure which logic is used to set line item values for shopware 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?


Solution

  • You can store the data in the Payload by subscribing the LineItemAddedEvent. As shown here in the forum.

    For this to work, you have to send the additional data in the same request which is sending the cart-addition to the server to be able to fetch the data from the Request you can inject to the subscriber.