How to save one API response to WooCommerce order meta data
You’re very close. $order->update_meta_data() will update the meta value inside the $order object, but it will not store the change in the database. To save changes to a WooCommerce CRUD object you need to run the save() method: if ( $response_code == 200 ) { $order->update_meta_data( ‘token_received_key’, $token ); $order->save(); }