How to update WordPress order
-
I have made this function:
add_action(‘woocommerce_checkout_update_order_meta’, ‘my_own_function’);
function my_own_function ( $order_id ) {
$order = new WC_Order($order_id);
$order->shipping_last_name = ‘TEST’;
}Now if I write the $order->shipping_last_name to a log-file in that function, then the name is correctly printed as TEST. But when I recieve the order, then that last name is the value that user gave when ordering.
So I am not sure if that function is called before the order is updated with the user given values, or is that order actually never saved with my updated value? How could I do this so that the value would be saved properly?
The topic ‘How to update WordPress order’ is closed to new replies.