WooCommerce-POS
WooCommerce-POS copied to clipboard
Question: Searching customers including meta data
Is there a custom hack to be able to search users including their wp meta_data table fields, eg. billing_company? As in, searching the customers on the front-end cart.
I've been at this nearly all day for a friend and now I'm banging my head on the desk.
This file is the ajax call plugins/woocommerce-pos/includes/api/class-wc-pos-customers.php
I assume does the db searching but all I see it just manipulating the $wp_user_query->query_where
.
Normally the WP_User_Query
just needs the :
'meta_query' => array ( array ( 'relation' => 'LIKE', array( 'key' => 'billing_company', 'value' => $term ) ) )
TIA
Hi,
as far as I can tell (from the tests I have made) you should be able to search by:
- username
- first name
- last name
- billing phone number
- billing company
you can see how I tested here: http://take.ms/eNsJk
2 customers with company: The Flower Shop 1 customer with phone number containing: 666 1 customer with phone number containing: 999
it's been tested with 0.5 beta
I've seen issues with the local db not syncing properly with the backend so you might want to clear the local db (POS Menu>Support>Local storage box>Clear customers
)
let me know if this helps
Thomas is correct, in version 0.5 the following fields are searched. Note that customers are stored locally, so search actually happens in javascript, adding custom PHP won't change how the POS operates.
Version 0.4 only searches the following fields by default: email
, username
, first_name
and last_name
.
Also please note that search is something that is still being developed on the WC REST API side. Both WooCommerce and WooCommerce POS are working towards a future where every attribute can be searched and default settings can be set.