woocommerce_new_order_data

The WooCommerce woocommerce new order data hook.

Description

apply_filters( 'woocommerce_new_order_data', (callback) $order_get_status_edit ); 

Parameters (1)

0. $order_get_status_edit — Optional. (callback) => 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' => 'wc-' . ( $order->get_status( 'edit' ) ? $order->get_status( 'edit' ) : apply_filters( 'woocommerce_default_order_status', 'pending' ) ), 'ping_status' => 'closed', 'post_author' => 1, 'post_title' => $this->get_post_title(), 'post_password' => uniqid( 'order_' ), 'post_parent' => $order->get_parent_id( 'edit' ), 'post_excerpt' => $this->get_post_excerpt( $order ), )
The array.

Usage

To run the hook, copy the example below.
  1. $order_get_status_edit = apply_filters( 'woocommerce_new_order_data', $order_get_status_edit ); 
  2.  
  3. if ( !empty( $order_get_status_edit ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_new_order_data callback 
  2. function filter_woocommerce_new_order_data( $order_get_status_edit ) { 
  3. // make filter magic happen here... 
  4. return $order_get_status_edit
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_new_order_data', 'filter_woocommerce_new_order_data', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_new_order_data', 'filter_woocommerce_new_order_data', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/data-stores/abstract-wc-order-data-store-cpt.php  
  1. $id = wp_insert_post( apply_filters( 'woocommerce_new_order_data', array(