How to add a custom cart promotion rule?
1. Create a New Promotion Rule Checker
<?php
namespace App\Promotion\Checker\Rule;
use Sylius\Component\Promotion\Checker\Rule\RuleCheckerInterface;
use Sylius\Component\Promotion\Model\PromotionSubjectInterface;
class PremiumCustomerRuleChecker implements RuleCheckerInterface
{
public const TYPE = 'premium_customer';
public function isEligible(PromotionSubjectInterface $subject, array $configuration): bool
{
return $subject->getCustomer()?->isPremium() === true;
}
}2. Add a Premium Field to the Customer Entity
3. Extend the Customer Admin Form
4. Create the Template Section for the Premium Field

5. Create a Configuration Form Type (Optional)
6. Register Services
✅ Result



Last updated
Was this helpful?
