woocommerce_new_order_data
Filters the data for a new order before it is inserted into the database.
Usage
add_filter( 'woocommerce_new_order_data', 'wp_kama_woocommerce_new_order_data_filter' ); /** * Function for `woocommerce_new_order_data` filter-hook. * * @param array $data Array of data for the new order. * * @return array */ function wp_kama_woocommerce_new_order_data_filter( $data ){ // filter... return $data; }
- $data(array)
- Array of data for the new order.
Changelog
Since 3.3.0 | Introduced. |
Where the hook is called
woocommerce_new_order_data
woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php 91-105
apply_filters( 'woocommerce_new_order_data', array( 'post_date' => gmdate( 'Y-m-d H:i:s', $order->get_date_created( 'edit' )->getOffsetTimestamp() ), 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', $order->get_date_created( 'edit' )->getTimestamp() ), 'post_type' => $order->get_type( 'edit' ), 'post_status' => $this->get_post_status( $order ), 'ping_status' => 'closed', 'post_author' => 1, 'post_title' => $this->get_post_title(), 'post_password' => $this->get_order_key( $order ), 'post_parent' => $order->get_parent_id( 'edit' ), 'post_excerpt' => $this->get_post_excerpt( $order ), ) ),