custom query to add billing phone field to admin customer list
-
This feature to add the billing phone field into admin customer list actually has been asked many times
https://www.ads-software.com/support/topic/customizing-customer-columns-in-admin/
https://www.ads-software.com/support/topic/add-more-column-to-woocommerce-customers/
https://www.ads-software.com/support/topic/add-phone-to-customer-table-list/
https://github.com/woocommerce/woocommerce/issues/30505
But seem still haven’t got feedback from woocommerce team. Hence I tried to dig into this issue by myself.
I am following this tutorial to create the extension:
https://developer.woocommerce.com/2020/02/20/extending-wc-admin-reports/
This is the snippets that I come with:
add_filter( 'woocommerce_analytics_clauses_join_customers_subquery', 'add_join_subquery' ); function add_join_subquery($clauses){ global $wpdb; $tbl = $wpdb->usermeta; $ctbl = $wpdb->prefix.'wc_customer_lookup'; $clauses[] = "JOIN {$tbl} AS meta ON {$ctbl}.customer_id = meta.user_id AND meta.meta_key = 'billing_phone'"; return $clauses; }
But this give me the empty data set. What is wrong with the codes?
- The topic ‘custom query to add billing phone field to admin customer list’ is closed to new replies.