Shopify:通过 API 调用从集合中删除产品 [英] Shopify: Remove product from collection via API call
问题描述
我正在尝试使用 Shopify API 从产品系列中删除产品.
I'm trying to use the Shopify API to remove products from a collection.
在文档中(https://docs.shopify.com/api/collect)概述它说:
In the docs (https://docs.shopify.com/api/collect) overview it says:
DELETE /admin/collects/#{id}.json
Remove a Collect from the database
当你跳转到描述时,它说:
While when you jump to the description it says:
Remove a product from a collection
Destroy the link between a product an a collection
DELETE /admin/collects/#{id}.json
那么我可以使用它从集合中删除产品或从数据库中删除一个集合吗?
So can I use this to remove a product form a collection or remove a collection from the DB?
如果可以从产品系列中删除产品 - 我想要做什么 - 我应该传递产品系列 ID 还是产品 ID - 实际上我认为我必须同时通过两者,否则它应该如何工作?
And if it's possible to remove a product from a collection - what I want to do - shall I pass the collection ID or the product ID - actually I think I have to pass both, or how shall it work otherwise?
感谢您的帮助!
推荐答案
Collect 是产品和集合之间多对多关系的连接表.它有自己的id.要从集合中删除产品,您只需删除连接,因此您只需使用集合 ID 而不是产品 ID 或集合 ID.
Collect is the join table for a many-to-many relationship between a product and a collection. It has its own id. To remove the product from a collection you are just removing the join so you only have to use the collect id not the product id or the collection id.
如果您有产品 ID 和集合 ID,您可以通过以下方式获取集合 ID:
If you have the product id and the collection id you can get the collect id via:
GET /admin/collects.json?product_id=1925263361&collectionid=29722105
这篇关于Shopify:通过 API 调用从集合中删除产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!