woocommerce_store_api_checkout_update_order_meta хук-событиеWC 1.0

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.

Использование

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.

Где вызывается хук

Checkout::create_or_update_draft_order()
woocommerce_store_api_checkout_update_order_meta
woocommerce/packages/woocommerce-blocks/src/StoreApi/Routes/V1/Checkout.php 353
do_action( 'woocommerce_store_api_checkout_update_order_meta', $this->order );

Где используется хук в WooCommerce

Использование не найдено.