Skip to content

Commit 89bfc6f

Browse files
authored
Remove other discount lines before re adding (#428)
1 parent 8fa3709 commit 89bfc6f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Core/Orders/Factories/OrderFactory.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,12 @@ protected function resolveDiscounts(&$order)
557557

558558
$tax = $this->tax->amount($taxable);
559559

560+
// Does this product already exist on the order
561+
$order->lines()
562+
->whereSku($variant->sku)
563+
->where('discount_total', '!=', 0)
564+
->delete();
565+
560566
$order->lines()->create([
561567
'product_variant_id' => $variant->id,
562568
'sku' => $variant->sku,

0 commit comments

Comments
 (0)