woocommerce_customer_get_order_count
Filters total orders count value for a given customer.
Использование
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(разное)
- The cached order count (from user meta).
- $customer(WC_Customer)
- The customer to get the orders count for.
Список изменений
| С версии 4.9.0 | Введена. |
Где вызывается хук
woocommerce_customer_get_order_count
woocommerce/includes/data-stores/class-wc-customer-data-store.php 450-454
$count = apply_filters( 'woocommerce_customer_get_order_count', Users::get_site_user_meta( $customer_id, 'wc_order_count', true ), $customer );