woocommerce_store_api_checkout_update_order_meta хук-событиеWC 7.2.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.

Список изменений

С версии 7.2.0 Введена.

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

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

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

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