# LineItem in den Warenkorb hinzufügen

**URL:** <https://forum.shopware.com/t/lineitem-in-den-warenkorb-hinzufugen/64689>\
**Category:** Programmierung\
**Created:** [13. Februar 2020 um 15:04 UTC](https://forum.shopware.com/t/lineitem-in-den-warenkorb-hinzufugen/64689 "2020-02-13T15:04:18Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![binaermanufaktur](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@binaermanufaktur](https://forum.shopware.com/u/binaermanufaktur)\
**Post date:** [24. Februar 2020 um 09:40 UTC](https://forum.shopware.com/t/lineitem-in-den-warenkorb-hinzufugen/64689/6 "2020-02-24T09:40:13Z")

</div>

Sorry, erst jetzt gelesen. ganz grob so:

```
$lineItem = new LineItem(
                Uuid::randomHex(),
                'custom'
            );
            $lineItem->setStackable(true);
            $lineItem->setRemovable(true);
            $lineItem->setLabel($label);
            $lineItem->setPriceDefinition($quantityPriceDefinition);
            $lineItem->setQuantity($quantity);
            $lineItem->setDeliveryInformation(new DeliveryInformation(100, 10.0, false));
            $this->cartService->add($cart,$lineItem, $salesChannelContext);
            $this->cartService->recalculate($cart, $salesChannelContext);

```

Wobei die quantityPriceDefinition auch eine andere Art der PriceDefinition sein kann.

Aber problematisch ist leider zur Zeit, dass custom LineItems nicht richtig kalkuliert werden!

[https://issues.shopware.com/issues/NEXT-6936](https://issues.shopware.com/issues/NEXT-6936)

---

_[View the full topic](https://forum.shopware.com/t/lineitem-in-den-warenkorb-hinzufugen/64689)._
