I am trying to update an order's custom field after order complete. I set it like this in my plugin:
Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function(Event $e) {
$order = $e->sender;
$order->setFieldValue("customFieldHandle", "My value");
});
But it is not working. I guess I used the wrong method to do it.