I've been struggling with this issue for the past few weeks now.

My goal is to set a custom price for an item after I edit them on Cart.

Basically, I'm using an observer on the event checkout_cart_update_item_complete, and on that observer I eventually do the following:


Where $item is the new quote item after the update (check Magento\Checkout\Controller\Cart\UpdateItemOptions.php) and $price is my custom price.

After this, the quote item price gets the value of 0, even though the custom_price field on database is actually the value that I wanted.

Any help is appreciated :)

  • have you check that the controller comes in that file or not? Commented Dec 4, 2018 at 17:38

2 Answers 2


Try to write your custom code under process() function.


     * Quote item discount calculation process
     * @param AbstractItem $item
     * @return $this
    public function process(AbstractItem $item)
     $price = 50;


NOTE: Don't use $item->save() once and try.

I hope it help..!!

  • Tried it, didn't work :( even without the $item->save(). Thanks anyways!
    – gasparrmg
    Commented Dec 5, 2018 at 9:50
  • @gasparrmg have you tried your code in this vendor\magento\module-sales-rule\Model\Validator.php file? Commented Dec 5, 2018 at 10:00
  • Yes, it did not work. But even if it did, I wanted to this through my observer and not by extending/overriding this class :/
    – gasparrmg
    Commented Dec 5, 2018 at 10:01
  • @BalwantSingh, same i am facing, without save() also its not working Commented Mar 1, 2019 at 16:21
  • It is not working. Commented Apr 22, 2019 at 7:33

You should override Magento\Catalog\Model\Product\Type\Price


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\Product\Type\Price" type="SY\Modulename\Model\Catalog\Product\Type\Price" />

and redefine getBasePrice

namespace SY\Modulename\Model\Catalog\Product\Type;
class Price extends \Magento\Catalog\Model\Product\Type\Price {
    public function getBasePrice($product, $qty = null) {
        $price = (float) $product->getPrice();
        return min(
            $this->_applyTierPrice($product, $qty, $price),
            $this->_applySpecialPrice($product, $price),
            1.11 // where is your custom product price

for some reasons magento can ignore override for Magento\Catalog\Model\Product\Type\Price and then you should override Magento\Catalog\Model\Product\Type\FrontSpecialPrice

Also you can do this via observer


<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_get_final_price">
        <observer name="custom_price" instance="SY\Modulename\Observer\CatalogProductGetFinalPrice"/>


namespace SY\Modulename\Observer;
class CatalogProductGetFinalPrice implements \Magento\Framework\Event\ObserverInterface {
    public function execute(\Magento\Framework\Event\Observer $observer){
        $_product->setFinalPrice(your custom price);
        return $this;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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