Magento 2: Is it possible to add additional general/store_information configuration through my custom module?

magento.stackexchange https://magento.stackexchange.com/questions/121227

  •  30-09-2020
  •  | 
  •  

Question

Reading articles relating to calling store name and other admin fields, this post specifically.

I'm creating a module (my first for Magento 2) for my client but want to add an additional field (company registration number) and have it appear in the General > Store Information tab under the VAT number, is this possible? I currently have other fields appear in my own system tab.

Was it helpful?

Solution

Try following way


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="store_information" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="merchant_vat_number1" translate="label" type="text" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>VAT Number1</label>
                    <can_be_empty>1</can_be_empty>
                </field>
            </group>
        </section>
    </system>
</config>

If your module has system.xml then you need to add <section> only otherwise whole text inside system.xml

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top