woocommerce_create_order
Gives plugins an opportunity to create a new order themselves.
Использование
add_filter( 'woocommerce_create_order', 'wp_kama_woocommerce_create_order_filter', 10, 2 ); /** * Function for `woocommerce_create_order` filter-hook. * * @param int|null $order_id Can be set to an order ID to short-circuit the default order creation process. * @param WC_Checkout $checkout Reference to the current WC_Checkout instance. * * @return int|null */ function wp_kama_woocommerce_create_order_filter( $order_id, $checkout ){ // filter... return $order_id; }
- $order_id(int|null)
- Can be set to an order ID to short-circuit the default order creation process.
- $checkout(WC_Checkout)
- Reference to the current WC_Checkout instance.
Список изменений
С версии 3.0.0 | Введена. |
С версии 3.0.0 | or earlier |
Где вызывается хук
woocommerce_create_order
woocommerce/includes/class-wc-checkout.php 382
$order_id = apply_filters( 'woocommerce_create_order', null, $this );
Где используется хук в WooCommerce
woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php 43
add_filter( 'woocommerce_create_order', array( __CLASS__, 'possibly_schedule_import' ) );