Magento 2 – How to Change a Label in System.xml of an Extension

adminhtmlmagento2system.xml

I purchased an extension and I want to change the label of a field in the admin to say 'Delivery Cut off Time' instead of 'Cut off Time'. This field is represented in the system.xml file of the extension

File: Bss/OrderDeliveryDate/etc/adminhtml/system.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="bss" translate="label" sortOrder="300">
            <label>Bss Commerce</label>
        </tab>
        <section id="orderdeliverydate" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Order Delivery Date</label>
            <tab>bss</tab>
            <resource>Bss_OrderDeliveryDate::config_orderdeliverydate</resource>
            <group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General</label>

                <field id="process_time" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Processing Time</label>
                    <comment><![CDATA[Delivery will be taken after(x) day(s) upon the date order(s) made.]]></comment>
                </field>

                <field id="cut_off_time" translate="label" type="time" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Cut Off Time</label>
                    <!-- <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> -->
                    <comment><![CDATA[If customers place order after this time the date when orders made will be counted as the following day.]]></comment>
                </field>
            </group>
        </section>
    </system>
</config>

I have gone ahead and created my own module to try to make this changes. MyVendor_MyModule. I created a system.xml file, but I am not sure what is the proper way to overwrite the label.

Best Answer

if you want to do it via custom module then you just need to add following code in your namespace/modulename/etc/adminhtml/system.xml

<?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="orderdeliverydate" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
           <resource>Bss_OrderDeliveryDate::config_orderdeliverydate</resource>
            <group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
               <field id="cut_off_time" translate="label" type="time" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Delivery Cut off Time</label>
                </field>
            </group>
        </section>
    </system>
</config>
Related Topic