[英]Fetch products which are available online - Shopify
I'm building a Shopify
app using Rails.我正在使用 Rails 构建Shopify
应用程序。 I want to fetch the products which are only available online
from the Collections
我想从Collections
获取仅available online
的产品
I have the following code to fetch the products but it returns all the products even if they are not available online我有以下代码来获取产品,但它会返回所有产品,即使它们在线不可用
ShopifyAPI::SmartCollection.find(collection_id).products
How to pass the conditions for products?如何通过产品的条件?
According to the Shopify API Reference , you can pass a published_status
and collection_id
parameters to your Api call to retrieve published products from a specific colleciton.根据Shopify API 参考,您可以将published_status
和collection_id
参数传递给您的Api 调用,以从特定集合中检索已发布的产品。
Using the Ruby library it gives:使用 Ruby 库,它提供:
ShopifyAPI::Product.find(:all, params: { published_status: 'published', collection_id: collection_id })
Hope it helps希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.