The default behaviour for commerce is to mark the isCompleted
flag on an order to true
once the order has been paid for.
I have need to alter this behaviour and only want to mark an order as Complete via manual intervention of a site admin - or after a predefined date has passed.
Is it possible to set the isCompleted flag from within a custom module?
Right now, I'm listening to the EVENT_AFTER_ORDER_PAID
then attempting to set the isCompleted flag and save the order.
What I can't figure out is how to save the order!
Code so far, for what it's worth:
Event::on(
Order::class,
Order::EVENT_AFTER_ORDER_PAID,
function(Event $e) {
$order = $e->sender;
$order->isCompleted = false; // no idea if this is correct
$order->saveOrder(); // this doesn't work
}
);