modify customer_first_order_date field
-
I would like to modify field customer_first_order_date, I make some function for displayed only orders with status wc-completed, this is my code
add_filter('woocommerce_customer_first_order_date', function($value, $customer){ global $wpdb; $statuses = array('wc-completed'); $first_date = $wpdb->get_var( "SELECT MIN( orders.post_date ) AS 'first_order_date', FROM $wpdb->users AS users INNER JOIN {$wpdb->postmeta} AS customer_ids ON users.ID = customer_ids.meta_value AND customer_ids.meta_key = '_customer_user' INNER JOIN $wpdb->posts AS orders ON customer_ids.post_id = orders.ID AND orders.post_type = 'shop_order' AND orders.post_status = IN ( '" . implode("','", $statuses) . "' ) AND users.ID = " . esc_sql($customer->get_id()) . " GROUP BY users.ID, users.display_name, orders.post_status ORDER BY MIN( orders.post_date )" ); error_log($first_date); return $first_date; },10,2);
`
but it does not work, looks like the hook does not fire, what did I do wrong?
PS I used this guide https://docs.algolplus.com/algol_order_export/modify-existing-fields/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘modify customer_first_order_date field’ is closed to new replies.