Skip to main content

Fields

The model used is Shopper\Core\Models\Discount.
NameTypeRequiredNotes
idautoincauto
codestringyesThe given code for the discount
typestringyesThe type of discount Shopper\Core\Enum\DiscountType
valueintyesDepends on the type of discount you want to apply. It can be a percentage or a fixed amount
is_activebooleannoDefines the visibility of the discount for customers.
apply_tostringyesDefines what the discount can be applied to Shopper\Core\Enum\DiscountApplyTo
min_requiredstringyesDefines the conditions required to apply the discount Shopper\Core\Enum\DiscountRequirement
min_required_valuestringnoThe minimum value required after defining the required condition, default NULL
eligibilitystringyesDefines discount eligibility conditions Shopper\Core\Enum\DiscountEligibility
usage_limitintnoHow many uses the discount has had
usage_limit_per_userbooleannoDefines whether the coupon can be used more than once by customers
total_useintnoThe number of times the discount has been used, default 0
start_atdatetimeyesThe datetime the discount starts
end_atdatetimenoThe datetime the discount expires, if NULL it won’t expire
metadataarraynoNULL, json column to save any data key:value
zone_idintnoThe area in which the discount can be applied. If NULL, the discount can be applied anywhere.

Components

By default, discounts Livewire components are not published. To customize components, you must publish them.
php artisan shopper:component:publish discount
This command will publish all Livewire components used for discount management (from pages to form components). Once you’ve published the component, you can find it in the discount.php locate in the config/shopper/components folder.
use Shopper\Livewire;

return [
  'pages' => [
        'discount-index' => Livewire\Pages\Discount\Index::class,
    ],
    
    'components' => [
        'slide-overs.discount-form' => Livewire\SlideOvers\DiscountForm::class,
    ],
];

Manage Discount