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 )概述它说:
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?
感谢您的帮助!
推荐答案
收集是一个产品和集合之间的许多一对多的关系连接表。它有自己的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屋!