woocommerce_analytics_update_order_stats_data
Filters order stats data.
Usage
add_filter( 'woocommerce_analytics_update_order_stats_data', 'wp_kama_woocommerce_analytics_update_order_stats_data_filter', 10, 2 ); /** * Function for `woocommerce_analytics_update_order_stats_data` filter-hook. * * @param array $data Data written to order stats lookup table. * @param WC_Order $order Order object. * * @return array */ function wp_kama_woocommerce_analytics_update_order_stats_data_filter( $data, $order ){ // filter... return $data; }
- $data(array)
- Data written to order stats lookup table.
- $order(WC_Order)
- Order object.
Changelog
Since 4.0.0 | Introduced. |
Where the hook is called
woocommerce_analytics_update_order_stats_data
woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php 526-545
$data = apply_filters( 'woocommerce_analytics_update_order_stats_data', array( 'order_id' => $order->get_id(), 'parent_id' => $order->get_parent_id(), 'date_created' => $order->get_date_created()->date( 'Y-m-d H:i:s' ), 'date_paid' => $order->get_date_paid() ? $order->get_date_paid()->date( 'Y-m-d H:i:s' ) : null, 'date_completed' => $order->get_date_completed() ? $order->get_date_completed()->date( 'Y-m-d H:i:s' ) : null, 'date_created_gmt' => gmdate( 'Y-m-d H:i:s', $order->get_date_created()->getTimestamp() ), 'num_items_sold' => self::get_num_items_sold( $order ), 'total_sales' => $order->get_total(), 'tax_total' => $order->get_total_tax(), 'shipping_total' => $order->get_shipping_total(), 'net_total' => self::get_net_total( $order ), 'status' => self::normalize_order_status( $order->get_status() ), 'customer_id' => $order->get_report_customer_id(), 'returning_customer' => $order->is_returning_customer(), ), $order );