【问题标题】:How to filter SmartCollections via Shopify API?如何在 Shopify API 中过滤智能收藏?
【发布时间】:2015-10-11 12:03:28
【问题描述】:

我只需要获取那些模仿某种产品类别的 SmartCollections,例如裤子,衬衫,鞋子。但也有诸如“所有产品”或“可在本地商店购买”之类的集合。我需要通过 API 获取的只是那些特定的类别,没有别的。

那么有什么方法可以设置某种元字段或 SmartCollections 的替代方法,以便我可以仅通过 API 过滤我需要的集合?

当然,一个(而且非常糟糕)的方法是硬编码不想要的集合列表,但这个解决方案不是很动态:/

我正在使用来自大气js.com 的这个包froatsnook:shopify。 这是 Shopify 关于 SmartCollections 的 API 文档:SmartCollection

【问题讨论】:

    标签: node.js meteor shopify


    【解决方案1】:

    好的,尽管 API 不同意我的观点,但我还是设法做到了。使用此 Chrome 扩展程序,您还可以将元字段与 SmartCollections 一起使用:http://shopifyfd.com/

    然后您只需通过froatsnook:shopify 提供的内置功能为这个新端点创建新功能,如下所示:

    Shopify.API.define({
        "name": "getSmartCollectionMetafieldsById",
        "method": "GET",
        "path": "/admin/smart_collections/#{collection_id}/metafields.json",
        "returns": "metafields",
        "description": "Get a single smart_collection metafields by its ID"
    });
    

    瞧!现在您可以使用元字段通过 API 包含/排除 SmartCollections!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多