src/Model/OrderItem.php
public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        if ($this->OrderID && $this->Order() && $this->Order()->isCart()) {
            $this->calculatetotal();
        }
    }
public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        if ($this->OrderID && $this->Order() && $this->Order()->isCart()) {
            $this->calculatetotal();
        }
    }
Recalculate total before saving to database.