How to override system.xml core file in magento2
-
03-10-2020 - |
Question
I would like to change New order status text to something else at payment method section of magento2 admin.
Admin->Store->Configuration->Sales->Payment method->Check / Money Order
See attachment for better reference.
I know that i can change this by core changes but i would like to change this text without making any change in core file.
I am able to do this by editing system.xml
vendor/magento/module-offline-payments/etc/adminhtml/system.xml
Solution
Magento may load our custom system config and merge into the exist nodes. In our custom system config, we should try:
Tested on Magento 2.0.2 and 2.1.2
Vendor/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="payment">
<group id="checkmo">
<field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Custom New Order Status</label> <!-- Custom label -->
</field>
</group>
</section>
</system>
</config>
Remember to add overridden module - Magento_OfflinePayments
Vendor/ModuleName/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_YourModule" setup_version="1.0.0">
<sequence>
<module name="Magento_OfflinePayments"/>
</sequence>
</module>
</config>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange