woocommerce_customer_get_total_spent
Filters total spent value for a given customer.
Usage
add_filter( 'woocommerce_customer_get_total_spent', 'wp_kama_woocommerce_customer_get_total_spent_filter', 10, 2 );
/**
* Function for `woocommerce_customer_get_total_spent` filter-hook.
*
* @param mixed $money_spent The cached money spent value (from user meta).
* @param WC_Customer $customer The customer to get the total spent for.
*
* @return mixed
*/
function wp_kama_woocommerce_customer_get_total_spent_filter( $money_spent, $customer ){
// filter...
return $money_spent;
}
- $money_spent(mixed)
- The cached money spent value (from user meta).
- $customer(WC_Customer)
- The customer to get the total spent for.
Changelog
| Since 3.1.0 | Introduced. |
Where the hook is called
woocommerce_customer_get_total_spent
woocommerce/includes/data-stores/class-wc-customer-data-store.php 496-500
$spent = apply_filters( 'woocommerce_customer_get_total_spent', Users::get_site_user_meta( $customer_id, 'wc_money_spent', true ), $customer );