【问题标题】:Shopify: Remove product from collection via API callShopify:通过 API 调用从集合中删除产品
【发布时间】:2015-12-19 00:54:44
【问题描述】:

我正在尝试使用 Shopify API 从集合中删除产品。

在文档 (https://docs.shopify.com/api/collect) 概述中说:

DELETE /admin/collects/#{id}.json
Remove a Collect from the database

当您跳转到描述时,它会说:

Remove a product from a collection
Destroy the link between a product an a collection
DELETE /admin/collects/#{id}.json

那么我可以使用它从集合中删除产品或从数据库中删除集合吗?

如果可以从集合中删除产品 - 我想要做什么 - 我应该传递集合 ID 还是产品 ID - 实际上我认为我必须同时通过两者,否则它将如何工作?

感谢您的帮助!

【问题讨论】:

    标签: api shopify


    【解决方案1】:

    Collect 是产品和集合之间多对多关系的连接表。它有自己的 id。要从集合中移除产品,您只需移除连接,因此您只需使用集合 ID,而不是产品 ID 或集合 ID。

    如果您有产品 ID 和收藏 ID,您可以通过以下方式获取收藏 ID:

    GET /admin/collects.json?product_id=1925263361&collectionid=29722105
    

    【讨论】:

    • API 中有许多未记录或不正确的元素。
    • CustomCollections 和 SmartCollections 使用相同的收集。您必须注意不要手动删除 SmartCollection Collect,因为这会导致错误。然而,目前很难确定收集是来自 CustomCollection 还是来自 SmartCollection。
    猜你喜欢
    • 2020-06-01
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2012-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多