To get a store config value in Magento 2, you can use the scopeConfig object, which is available via dependency injection. Here's how you can do it.

1. Inject ScopeConfigInterface in Your Class

First, you need to inject the ScopeConfigInterface in your constructor. This is how you can do it:
 
<?php

/**
 * Magekwik Software
 *
 * @category    Magekwik
 * @package     Magekwik_AjaxCall
 * @author      Magekwik
 * @copyright   Copyright (c)  Magekwik Software Private Limited (https://Magekwik.com)
 * @license     https://store.Magekwik.com/license.html
 */

namespace Vendor\Module\Helper;

use Magento\Framework\App\Config\ScopeConfigInterface;

class Config
{
    const NAME = 'section_id/group_id/field_id';

    private ScopeConfigInterface $scopeConfigInterface;

    /**
     * @param ScopeConfigInterface $scopeConfigInterface
     */
    public function __construct(
        ScopeConfigInterface $scopeConfigInterface
    )
    {
        $this->scopeConfigInterface = $scopeConfigInterface;
    }

    public function isEnable()
    {
        return $this->scopeConfigInterface->getValue(self::NAME);

    }
}

2. Explanation

  • ScopeConfigInterface: This is the interface that provides methods to retrieve configuration values.
  • $configPath: This is the path to the config value you want to retrieve, usually in the format section/group/field.
  • SCOPE_STORE: This defines the scope from which the config value is retrieved. Commonly used scopes are:
    • SCOPE_STORE: For store-specific configuration.
    • SCOPE_WEBSITE: For website-specific configuration.
    • SCOPE_DEFAULT: For the default configuration.