I am using event - checkout_cart_save_after to update cart item's price. But Item price is not getting updated.

Below is the code.

foreach ($observer->getCart()->getQuote()->getAllVisibleItems() as $item) {
    if ($item->getParentItem()) {
        $item = $item->getParentItem();

    $item_price = $item->getProduct()->getFinalPrice();

    $price_for_tier = $item_price + 50;

  • Check first observer class is call or not? Jan 30 '18 at 5:49
  • yes its getting called. I can echo price.
    – Nitz
    Jan 30 '18 at 5:50
  • Try it with checkout_cart_product_add_after event. Jan 30 '18 at 5:54
  • I tried. It will update only one item price and not all
    – Nitz
    Jan 30 '18 at 5:57
  • You can get cart items like this $item = $observer->getEvent()->getData('quote_item'); $item = ( $item->getParentItem() ? $item->getParentItem() : $item ); After you can use $item in foreach. Jan 30 '18 at 6:00

if you see "sales_order_item" item table in Database then you can find below fields which are related to price


So you can use like below


Please Note: You also need to other filed like "raw_total","base_row_total" etc.


It worked with below code -

$cart = $observer->getData('cart');

$quote = $cart->getData('quote');

$items = $quote->getAllVisibleItems();

foreach($items as $item)

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.