woocommerce_customer_get_order_count
Filters total orders count value for a given customer.
Usage
add_filter( 'woocommerce_customer_get_order_count', 'wp_kama_woocommerce_customer_get_order_count_filter', 10, 2 );
/**
* Function for `woocommerce_customer_get_order_count` filter-hook.
*
* @param mixed $order_count The cached order count (from user meta).
* @param WC_Customer $customer The customer to get the orders count for.
*
* @return mixed
*/
function wp_kama_woocommerce_customer_get_order_count_filter( $order_count, $customer ){
// filter...
return $order_count;
}
- $order_count(mixed)
- The cached order count (from user meta).
- $customer(WC_Customer)
- The customer to get the orders count for.
Changelog
| Since 4.9.0 | Introduced. |
Where the hook is called
woocommerce_customer_get_order_count
woocommerce/includes/data-stores/class-wc-customer-data-store.php 440-444
$count = apply_filters( 'woocommerce_customer_get_order_count', Users::get_site_user_meta( $customer_id, 'wc_order_count', true ), $customer );