1

I need to submit the following information to a third-party. I've started working on a PHP file (outside of Magento 2) to get the data from the Magento database but I'm having issues getting custom attribute text at the moment and I understand using the API is probably the way to go but I can't seem to get it working.

How can I create a function that runs as soon as I mark an order as complete? This would enable me to send the ID of the order that is marked complete to the third-party.

1 Answer 1

1

There is an event sales_order_save_after, which is fired just after order is saved. Create an observer for this event and based on order status execute your logic (see \Magento\Reward\Observer\OrderCompleted::execute as an example).

1
  • It'll be my first time creating a Magento 2 extension, but I'll give it a go! Jan 28, 2016 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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