woocommerce_store_api_checkout_order_created
Fires once when the Store API checkout draft order is first materialised.
Use this hook for first-touch logic that should only run when the draft order is initially created (e.g. analytics, abandoned-cart trackers). As of WooCommerce 10.8.0 the Store API defers draft order creation to place-order time, so this action fires once at POST rather than on the first PATCH.
Использование
add_action( 'woocommerce_store_api_checkout_order_created', 'wp_kama_woocommerce_store_api_checkout_order_created_action' );
/**
* Function for `woocommerce_store_api_checkout_order_created` action-hook.
*
* @param \WC_Order $order Order object.
*
* @return void
*/
function wp_kama_woocommerce_store_api_checkout_order_created_action( $order ){
// action...
}
- $order(\WC_Order)
- Order object.
Список изменений
| С версии 10.8.0 | Введена. |
Где вызывается хук
woocommerce_store_api_checkout_order_created
woocommerce/src/StoreApi/Routes/V1/Checkout.php 791
do_action( 'woocommerce_store_api_checkout_order_created', $this->order );