Magento 2 Status Processing for Check / Money Order Payments
In Magento 2 you can use the admin option New Order Status within Stores ->
Configuration -> Sales -> Payment Methods
. Unfortunately it is not possible to
change the status to Processing
for Offline Payment Methods such as Check /
Money order
with the code name checkmo
. By default you are stuck with
Pending
but this can be fixed using the code in this article.
An illustration screenshot from the selection page:
To add Processing
to this dropdown selection. Add code below to the file app/code/YOUR-VENDOR/YOUR-MODULE/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">
<source_model>Magento\Sales\Model\Config\Source\Order\Status\Newprocessing</source_model>
</field>
</group>
</section>
</system>
</config>
Also include:
app/code/YOUR-VENDOR/YOUR-MODULE/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="YOUR-VENDOR_YOUR-MODULE" setup_version="0.0.1">
<sequence>
<module name="Magento_OfflinePayments"/>
</sequence>
</module>
</config>
app/code/YOUR-VENDOR/YOUR-MODULE/registration.php
<?php \Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE, 'YOUR-VENDOR_YOUR-MODULE',
__DIR__
);
Change YOUR-VENDOR
and YOUR-MODULE
names in the code and file paths. For
example: app/code/Greatcompany/Custom
.
Enable the module using the magento binary:
magento module:enable YOUR-VENDOR_YOUR-MODULE
magento setup:upgrade
Unfortunately after selecting Processing
as the new order status, the status
was still not working in my situation. The above change doesn’t seem to be used
by further code and is only visual.
I use the following additional code to force the status:
app/code/YOUR-VENDOR/YOUR-MODULE/etc/config.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<checkmo>
<active>1</active>
<model>Magento\OfflinePayments\Model\Checkmo</model>
<order_status>processing</order_status>
<title>Check / Money order</title>
<allowspecific>0</allowspecific>
<group>offline</group>
<payment_action>authorize_capture</payment_action>
</checkmo>
</payment>
</default>
</config>
This fixed it for the Magento 2 instance I am running. Make sure to clear your cache when testing.
Hope this helps your situation!