0

I have an observer who changes the price of the items and at the end of the routine the whole order changes, but on my cart edit screen the subtotal of the item still keeps the old price of the item, how can I fix this?

The functions used to make the change are:

$itemcarrinho->setCustomPrice($temp);                                        
$itemcarrinho->setOriginalCustomPrice($temp);                                     
$itemcarrinho->getProduct()->setIsSuperMode(true);
$itemcarrinho->save();

$quote->setSubtotal($total)
->setBaseSubtotal($total)
->setGrandTotal($total)
->setBaseGrandTotal($total);
$quote->save();

enter image description here

Magento 2.3.5

1

Try to clear checkout session storage in your observer before you save the quote.

See for code reference - \Magento\Checkout\Observer\UnsetAllObserver::execute()

| improve this answer | |
0

Solved. I had to change the price also by line by function:

$item->setRowTotal($item->getCustomPrice() * $item->getQty());
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.