2

How would I get a status notification to send when setting the status of an order dynamically via a plugin?

I've got a few different order 'types' that need a different default status (for different notifications), so I created a plugin that sets the status at onBeforeOrderComplete, which sets the status for the order just as expected, but no notifications are sent. There are no issues with the notification emails sending (when changing the status via the cp, they send out as normal).

My Code:

craft()->on('commerce_orders.onBeforeOrderComplete', function($event)
{
    $order = $event->params['order'];    
    if ($order->orderType == 'blah') {
        $order->orderStatusId = 1;
    } else {
        $order->orderStatusId = 3;
    }
});

0

Your Answer

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

Browse other questions tagged or ask your own question.