Internal meta keys have their own functions.
Instead of $order->get_meta('_shipping_phone')
Use $order->get_shipping_phone()
Instead of $order->update_meta_data('_billing_state', '')
Use
$order->set_billing_state('');
$order->save();
For a full list of what is available see https://woocommerce.github.io/code-reference/classes/WC-Order.html
-
This reply was modified 2 years, 6 months ago by yffaffy.