refactor(checkout): materialize purchase item snapshots at start
This commit is contained in:
@@ -154,12 +154,7 @@ class Purchase extends Model
|
||||
return (float) $this->getRelation('items')->sum('total');
|
||||
}
|
||||
|
||||
$itemsTotal = (float) $this->items()->sum('total');
|
||||
if ($itemsTotal > 0 || $this->items()->exists()) {
|
||||
return $itemsTotal;
|
||||
}
|
||||
|
||||
return (float) ($this->cart?->getTotalAmount() ?? $this->total ?? 0);
|
||||
return (float) $this->items()->sum('total');
|
||||
}
|
||||
|
||||
protected function valueChangeTenantCode(): string
|
||||
|
||||
Reference in New Issue
Block a user