0

I have a system.xml file in which i already have retrieved customer groups in a multiselectist field .Now i want to associate one field-To set some value for each customer group.How can i get these values from system.xml when customer clicks "proceed to checkout".And How can i redirect customer to */checkout/cart/ " .

As shown in image where furthur checkout process is disabled

1 Answer 1

0

When you save in Configuration, the value of your custom field will save in table "core_config_data" with column path is section_id/group_id/field_id and the column value is what you choose/enter value in your custom field.

To get value of section_id/group_id/field_id, you can use \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig in your constructor argument and set the class property $this->scopeConfig = $scopeConfig;

Now to get the configuration value in your function, just use:

$this->scopeConfig->getValue('section_id/group_id/field_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); 

It's look like this:

public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, ) { $this->scopeConfig = $scopeConfig; } public function yourFunction() { $valueCustomField = $this->scopeConfig->getValue('section_id/group_id/field_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); //do something here } 
3
  • How can i assign each customer group a value from another field in system.xml? Commented Apr 4, 2023 at 3:40
  • I think you can use dynamic row. You can read this developer.adobe.com/commerce/php/tutorials/admin/… Commented Apr 4, 2023 at 3:47
  • Please answer this "How can i get these values from system.xml when customer clicks "proceed to checkout".And How can i redirect customer to */checkout/cart/ " Commented Apr 7, 2023 at 4:39

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.