for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace Shopware\Core\Checkout\Customer\Rule;
use Shopware\Core\Checkout\CheckoutRuleScope;
use Shopware\Core\Framework\Rule\Rule;
use Shopware\Core\Framework\Rule\RuleConfig;
use Shopware\Core\Framework\Rule\RuleConstraints;
use Shopware\Core\Framework\Rule\RuleScope;
/**
* @package business-ops
*/
class IsActiveRule extends Rule
{
protected bool $isActive;
* @internal
public function __construct(bool $isActive = false)
parent::__construct();
$this->isActive = $isActive;
}
public function match(RuleScope $scope): bool
if (!$scope instanceof CheckoutRuleScope) {
return false;
$customer = $scope->getSalesChannelContext()->getCustomer();
if (!$customer) {
return $this->isActive === $customer->getActive();
public function getName(): string
return 'customerIsActive';
public function getConfig(): RuleConfig
return (new RuleConfig())
->booleanField('isActive');
public function getConstraints(): array
return [
'isActive' => RuleConstraints::bool(true),
];