# How to access plugin configuration or other services in the custom rule builder in shopware 6

**URL:** <https://forum.shopware.com/t/how-to-access-plugin-configuration-or-other-services-in-the-custom-rule-builder-in-shopware-6/106957>\
**Category:** Shopware 6 (English)\
**Created:** [2. April 2025 um 06:00 UTC](https://forum.shopware.com/t/how-to-access-plugin-configuration-or-other-services-in-the-custom-rule-builder-in-shopware-6/106957 "2025-04-02T06:00:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard1](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/richard1/32/25976_2.png) [@richard1](https://forum.shopware.com/u/richard1)\
**Post date:** [2. April 2025 um 06:00 UTC](https://forum.shopware.com/t/how-to-access-plugin-configuration-or-other-services-in-the-custom-rule-builder-in-shopware-6/106957/1 "2025-04-02T06:00:40Z")

</div>

When I’m trying to load the plugin configuration and other services, I’m facing some troubles and encountering errors. I need the plugin config here, and the connection is established through an API.

_Error: Cannot assign null to property YourPlugin\Core\Rule\CustomResponseCodeRule::$connection of type Doctrine\DBAL\Connection_

```auto
class CustomResponseCodeRule extends Rule
{
    private Connection $connection;
    private SystemConfigService $systemConfigService;
    private ContainerInterface $container;
    private CartService $cartService;
    protected $isResponseValue;
    protected string $operator;

    public function __construct(
        Connection $connection,
        SystemConfigService $systemConfigService,
        ContainerInterface $container,
        CartService $cartService,
    ) {
        parent::__construct();
        $this->connection = $connection;
        $this->systemConfigService = $systemConfigService;
        $this->container = $container;
        $this->cartService = $cartService;
        $this->isResponseValue = 1;
    }

    /**
     * @return string
     */
    public function getName(): string
    {
        return 'plugin_response_check';
    }

    /**
     * Override the match method to avoid session dependency
     * 
     * @param RuleScope $scope
     * @return bool
     */
    public function match(RuleScope $scope): bool
    {
        
        $pluginStatus = $this->systemConfigService->get('IntrumCreditHelper.config.status');
        if ($pluginStatus != 1) {
            return false;
        }

        $customer = $scope->getSalesChannelContext()->getCustomer();

        // Check for our rule and customer data
        if (!$scope instanceof CheckoutRuleScope || !$customer) {
            return true;
        }

        $cart = $this->cartService->getCart(
            $scope->getSalesChannelContext()->getToken(),
            $scope->getSalesChannelContext()
        );
        $totalAmount = $cart->getPrice()->getTotalPrice();
  }
}

```
