Magento 2 How can i override core system.xml file

Viewed 1993

I am using Magento 2.2.3 version. I have facing the problem in override core Magento CatalogInventory system xml file.

In default magento 2 backorders system configuration setting is global. I want to change that setting website wise. For this i have created one module in which etc/adminhtml directory i have created system.xml. Here is my custom module system.xml code.

<?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="cataloginventory" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="item_options" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="backorders" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    <label>Backorders</label>
                    <source_model>Magento\CatalogInventory\Model\Source\Backorders</source_model>
                    <backend_model>Magento\CatalogInventory\Model\Config\Backend\Backorders</backend_model>
                    <comment>Changing can take some time due to processing whole catalog.</comment>
                </field>
            </group>
        </section>
    </system>
</config>

I have research in google and found this link : https://inchoo.net/magento-2/allow-backorders-website-scope/ but it's did not worked for me.

I want to override Magento_CatalogInventory system.xml file and change backorders setting showInWebsite from 0 to 1.

Can you please help me for override or chnage core system.xml file in my custom module ?

0 Answers
Related