Mike N
Mike N

Reputation: 103

Always get Nil Returned When Querying Customers with Shopify_API Gem

I am trying to get a list of all customers for my shopify dev instance, but I always get Nil returned no matter how I structure my Customer API call using the Shopify_API Gem.

customers = ShopifyAPI::Customer.all returns nil, as do variations of .find with params. Whereas the example products = ShopifyAPI::Product.all returns all the products. According to the docs I should be able to get Customers back but I cant.. I have 5 in my shopify instance.

I set the app up to be a private app and set the base.site for the shopifyAPI like so ShopifyAPI::Base.site = "https://apikey:[email protected]"

Any help would be greatly appreciated.

Upvotes: 0

Views: 257

Answers (1)

David Lazar
David Lazar

Reputation: 11427

My customer finder always works... I use a slightly different one from you. Use this as an example to get you going.

 ShopifyAPI::Customer.find(:first, :from => :search, :params => { :q => "email:#{customer['email']}" })

Upvotes: 1

Related Questions