skip to Main Content

Hey guys I try to do some searching functions but it is not possible with shopifyAPI gem

ShopifyAPI::Product.find(:all, conditions: ["title LIKE ?", "%#search%"], params: {limit: 20, page: 1}) 

With this function I got all products.

ShopifyAPI::Product.find(:all, conditions: ["title LIKE ?", "%#search%"])

The same I got all products

ShopifyAPI::Product.search(parameters)

I found this function in this example but it is not a function anymore
=> ecommerce.shopify.com/c/shopify-apis-and-technology/t/ruby-shopifyapi-find-customer-by-email-215330

ShopifyAPI::Product.where({ "title LIKE ?" =>"%#{search}%" })

With this one I got all products, again

This is the shopify_api gem => help.shopify.com/api/reference/product.
This is the shopify_api => help.shopify.com/api/reference/product

2

Answers


  1. It doesn’t look to me like the Shopify API supports this. What you’re trying to do looks like ActiveRecord querying, but this gem only provides an Active Record-like syntax.

    The API does support searching based on product title, so perhaps you may be able to specify a single word or two from the product name it and it will match those?

    Login or Signup to reply.
  2. You can use direct fields to search like:

    ShopifyAPI::Product.find(:all, params: { limit: 10, 
                                             title: params[:title],               
                                             page: params[:page] })
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search