woocommerce_store_api_checkout_update_order_meta
Fires when the Checkout Block/Store API updates an order's meta data.
This hook gives extensions the chance to add or update meta data on the $order. Throwing an exception from a callback attached to this action will make the Checkout Block render in a warning state, effectively preventing checkout.
This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action:
- To keep the interface focused (only pass $order, not passing request data).
- This also explicitly indicates these orders are from checkout block/StoreAPI.
Usage
add_action( 'woocommerce_store_api_checkout_update_order_meta', 'wp_kama_woocommerce_store_api_checkout_update_order_meta_action' ); /** * Function for `woocommerce_store_api_checkout_update_order_meta` action-hook. * * @param \WC_Order $order Order object. * * @return void */ function wp_kama_woocommerce_store_api_checkout_update_order_meta_action( $order ){ // action... }
- $order(\WC_Order)
- Order object.
Changelog
Since 7.2.0 | Introduced. |
Where the hook is called
woocommerce_store_api_checkout_update_order_meta
woocommerce/src/StoreApi/Routes/V1/Checkout.php 470
do_action( 'woocommerce_store_api_checkout_update_order_meta', $this->order );