phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
568 stars 211 forks source link

How to search for not null values? #250

Open verdant-spark opened 2 years ago

verdant-spark commented 2 years ago

I'm trying to search through all customers in a store which has a lot of customers and want to exclude those with no email address. If I search using a URL such as: /customers/search.json?query=email:* then I get a correct set of results, however, when using the customer resource and search method I get all customers.

$query = 'email:*';
$customer_resource = $shopify->Customer();
   try {
       $customers = $customer_resource->search($query);
   }...

As an aside, the search resource can take a mixed param but the Customer resource declares it as a string (and so throws an IDE warning)

 * Customer -> Custom actions
 * --------------------------------------------------------------------------
 * @method array search(string $query = '')      Search for customers matching supplied query
 */
verdant-spark commented 2 years ago

(edited as I think I answered part of my own question, but then found a different problem...)