diff --git a/core/lib/Thelia/Model/Coupon.php b/core/lib/Thelia/Model/Coupon.php index 921078eda..616a7d040 100644 --- a/core/lib/Thelia/Model/Coupon.php +++ b/core/lib/Thelia/Model/Coupon.php @@ -41,6 +41,9 @@ use Thelia\Model\Tools\ModelEventDispatcherTrait; class Coupon extends BaseCoupon { + // Define the value of an unlimited coupon usage. + const UNLIMITED_COUPON_USE = -1; + use ModelEventDispatcherTrait; /** @@ -265,6 +268,9 @@ class Coupon extends BaseCoupon return CouponModuleQuery::create()->filterByCouponId($this->getId())->find(); } + public function isUsageUnlimited() { + return $this->getMaxUsage() == self::UNLIMITED_COUPON_USE; + } /** * Get coupon usage left, either overall, or per customer. *