# How does shopware set values for line items

**URL:** <https://forum.shopware.com/t/how-does-shopware-set-values-for-line-items/94109>\
**Category:** Shopware 6 (English)\
**Tags:** general\
**Created:** [27. April 2022 um 07:22 UTC](https://forum.shopware.com/t/how-does-shopware-set-values-for-line-items/94109 "2022-04-27T07:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omars](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@Omars](https://forum.shopware.com/u/Omars)\
**Post date:** [27. April 2022 um 07:22 UTC](https://forum.shopware.com/t/how-does-shopware-set-values-for-line-items/94109/1 "2022-04-27T07:22:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)\
**Post date:** [26. Dezember 2022 um 11:03 UTC](https://forum.shopware.com/t/how-does-shopware-set-values-for-line-items/94109/3 "2022-12-26T11:03:18Z")

</div>

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`.
