/** * Recalculates total after units total or adjustments total change. */ protected function recalculateTotal() { $this->total = $this->unitsTotal + $this->adjustmentsTotal; if ($this->total < 0) { $this->total = 0; } if (null !== $this->order) { $this->order->recalculateItemsTotal(); } }