1. Ensure proper directory structure
2. Create a new model file
app/models/spree/promotion/actions/
directory3. Implement your own Logic
perform
method.Spree::PromotionAction
model.promotion
method within any Spree::PromotionAction
.4. Register the New Action
config/initializers/spree.rb
and add the following line:5. Add Translations for the Admin Dashboard
config/locales/en.yml
:6. Restart Your Application
1. Ensure proper directory structure
2. Create a new model file
app/models/spree/promotion/rules/
directory:3. Implement your own Logic
Spree::PromotionRule
model.eligible?
method should return true
or false
to indicate if the promotion should be eligible for an order, based on your custom logic. Similarly, define actionable?
to evaluate line items against your promotion criteria.4. Register the Custom Rule
config/initializers/spree.rb
file:5. Create Promotion Rule view template
6. Add Translations for the Admin Dashboard
config/locales/en.yml
and add:7. Restart Your Application