Problem with PriceInfo in SessionCartItem


Hi @ all,
I would like to add the Price of the Subitems to the OnlineShopOrderItem.
For this I extended the class SessionCartItem and overridden the function getPriceInfo.

public function getPriceInfo(): IPriceInfo
if ($this->getProduct() instanceof AbstractSetProduct) {
    $priceInfo = $this->getProduct()->getOSPriceInfo($this->getCount(), $this->getSetEntries());
} else {
    $priceInfo = $this->getProduct()->getOSPriceInfo($this->getCount());

if ($priceInfo instanceof \Pimcore\Bundle\EcommerceFrameworkBundle\PricingManager\IPriceInfo) {

if ($subItems = $this->getSubItems()) {
    $totalPrice = $this->getProduct()->getPrice();
    $additionalPrice = 0;
    foreach ($subItems as $subItem) {
        $subProduct = $subItem->getProduct();
        if ($subProduct->getPrice())
            $additionalPrice = $subProduct->getPrice();

    if ($additionalPrice)
        $totalPrice = $totalPrice + $additionalPrice;


return $priceInfo;

When I call the function the first time the original price of the product is displayed - with each further call the calculated price is displayed.

What could that be?
I’m grateful for every tip! Many Thanks!!!



I’m not really sure about what you are trying to archive.
But when you what to modify what Pimcore writes into the OnlineShopOrderItem object, I would got for the place where the OnlineShopOrderItem objects are created - which is the OrderManager.
So I would create a custom OrderManager and overwrite this function…