Magento 2 – Detect Order Status Change and Send Email

magento2order-emailorder-status

We are updating the order status from external system directly on the database and it works fine for presentation purposes. However, Magento does not recognise the order status change to trigger relevant emails.

So the questions are:

Is there a way to 'tell' Magento that an order status changed and to process the change as normal (triggering the email as normal) ? No REST API known to us.

If not, should we be implementing a custom REST API end-point to trigger the email to be sent (even if that means statuses and email templates relations are stored elsewhere) ?

Best Answer

Editing Magento Database directly is the not recommended, The best approach is to make customer REST API.

in the new custom REST API, you can pass the order number or order increment ID, then you have to process everything by Magento framework .

Use this blog to know how you can create the custom REST API

https://www.thirdandgrove.com/creating-custom-rest-api-magento2

you can use this blog to send the order email

https://www.mageplaza.com/how-send-order-email-custom-email-address-magento-2.html

Related Topic