woocommerce_customer_get_total_spent_query filter-hook . WC 1.0
phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
Usage
add_filter( 'woocommerce_customer_get_total_spent_query', 'filter_function_name_2182', 10, 2 ); function filter_function_name_2182( $string, $customer ){ // filter... return $string; }
- $string
- -
- $customer
- -
Where the hook is called
woocommerce_customer_get_total_spent_query
woocommerce/includes/data-stores/class-wc-customer-data-store.php 414-426
apply_filters( 'woocommerce_customer_get_total_spent_query', "SELECT SUM(meta2.meta_value) FROM $wpdb->posts as posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id LEFT JOIN {$wpdb->postmeta} AS meta2 ON posts.ID = meta2.post_id WHERE meta.meta_key = '_customer_user' AND meta.meta_value = '" . esc_sql( $customer->get_id() ) . "' AND posts.post_type = 'shop_order' AND posts.post_status IN ( 'wc-" . implode( "','wc-", $statuses ) . "' ) AND meta2.meta_key = '_order_total'", $customer )