Magento – Magento 2: how to change default order status for Cash On Delivery Payment

magento-2.1magento2.1.11

I want to change the new order status for Cash On Delivery Payment Method to Processing

I tried to do this:

I tried below changes in vendor but it didn't worked:

vendor\magento\module-offline-payments\etc\adminhtml\system.xml

<group id="cashondelivery" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Cash On Delivery Payment</label>
 ----                
<field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
     <label>New Order Status</label>
      <source_model>Magento\Sales\Model\Config\Source\Order\Status\Newprocessing</source_model>
OR
<source_model>Magento\Sales\Model\Config\Source\Order\Status</source_model>
                </field>
---
</group>

Then I change in:

vendor\magento\module-offline-payments\etc\config.xml

<cashondelivery>
   <active>0</active>
   <model>Magento\OfflinePayments\Model\Cashondelivery</model>
   <order_status>processing</order_status>
   <title>Cash On Delivery</title>
   <allowspecific>0</allowspecific>
   <group>offline</group>
</cashondelivery>

also did not help. how can this be achieved?

Best Answer

You can achieve this from admin and need one change on system.xml Add below code:

<source_model>Magento\Sales\Model\Config\Source\Order\Status\Newprocessing</source_model>

Instead of

<source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model>

You will find the system.xml under

vendor/magento/module-offline-payments/etc/adminhtml/system.xml

Note: Direct edit on core is not a good practice you can copy/override these onto your theme and do the change.

Then follow the below steps:

Goto Store -> Configuration -> Sales -> Payment Methods

Under this you will find Other payment Methods click on that now you can see the Cash on delivery and other payment options.

Change the "New Order Status" status to processing. Check the screenshot.enter image description here

After doing all the changes please clean cache.

Thats it!

Related Topic