Wel i have plugin which shows price in frontend from custom attribute.
public function afterGetPrice(\Magento\Catalog\Model\Product $product, $price) {
if($product->getData('price_per_area')) $price = $product->getData('price_per_area');
return $price;
}
Now i need to revert price to original price when product is added to cart, made an observer with event: checkout_cart_product_add_before
public function execute(
\Magento\Framework\Event\Observer $observer
) {
$item = $observer->getEvent()->getData('product');
if($item->getData('price_per_area')){
$item->setPrice(($item->getSpecialPrice() ? $item->getSpecialPrice() : $item->getPrice()));
}
}
and here i have issue: product is added to cart but the price is still the one from custom attribute, when i click on update cart button then it shows the correct price
as you can see from screenshots the price which is shown in summary is correct in both cases.
also tried my observer with checkout_cart_product_add_after
result was same. tried with custom theme and luma
is it magento/template bug or there is some work around ?