woocommerce_customer_get_total_spent_query
Filters the SQL query used to get the combined total of all the orders from a given customer.
Usage
add_filter( 'woocommerce_customer_get_total_spent_query', 'wp_kama_woocommerce_customer_get_total_spent_query_filter', 10, 2 );
/**
* Function for `woocommerce_customer_get_total_spent_query` filter-hook.
*
* @param string $sql The SQL query to use.
* @param WC_Customer $customer The customer to get the total spent for.
*
* @return string
*/
function wp_kama_woocommerce_customer_get_total_spent_query_filter( $sql, $customer ){
// filter...
return $sql;
}
- $sql(string)
- The SQL query to use.
- $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_query
woocommerce/includes/data-stores/class-wc-customer-data-store.php 553
$sql = apply_filters( 'woocommerce_customer_get_total_spent_query', $sql, $customer );