woocommerce_analytics_is_test_order
Filter whether an order is a test order excluded from analytics.
Use this filter to customize test order detection beyond the default WCPay test mode check, e.g., to exclude orders from other payment gateways' test/sandbox modes.
Usage
add_filter( 'woocommerce_analytics_is_test_order', 'wp_kama_woocommerce_analytics_is_test_order_filter', 10, 2 );
/**
* Function for `woocommerce_analytics_is_test_order` filter-hook.
*
* @param bool $is_test Whether the order is a test order.
* @param \WC_Abstract_Order $order The order being checked (for refunds, this is the parent order).
*
* @return bool
*/
function wp_kama_woocommerce_analytics_is_test_order_filter( $is_test, $order ){
// filter...
return $is_test;
}
- $is_test(true|false)
- Whether the order is a test order.
- $order(\WC_Abstract_Order)
- The order being checked (for refunds, this is the parent order).
Changelog
| Since 10.7.0 | Introduced. |
Where the hook is called
woocommerce_analytics_is_test_order
woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php 745
return apply_filters( 'woocommerce_analytics_is_test_order', $is_test, $check_order );