0

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) ?

1

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

  • Have to use DB direct because REST API is too slow and expensive to process large quantities of orders. However for order status change we may need to go down the path of Custom REST API as you suggested – George Mar 31 '18 at 16:08
  • In this case, I suggest to add new attribute on Order level, the default value is empty. Then you can update this attribute instead of order status, and setup internal cron job to see if the status in this attribute is not the same as actual order status then cron job will change the status and send email from Magento server – WISAM HAKIM Mar 31 '18 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.