From 3ceec410342202ffa98a1d52dc8aa81a1c84bc12 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 16 Aug 2023 15:27:25 +0200 Subject: [PATCH] fix decrementing usages_left when promo is unlimited --- src/Promocodes.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Promocodes.php b/src/Promocodes.php index f97d578..24dcce8 100644 --- a/src/Promocodes.php +++ b/src/Promocodes.php @@ -251,7 +251,9 @@ public function apply(): ?PromocodeContract event(new GuestAppliedPromocode($this->promocode)); } - $this->promocode->decrement('usages_left'); + if (!$this->promocode->isUnlimited()) { + $this->promocode->decrement('usages_left'); + } return $this->promocode; }