简体   繁体   中英

How do I add an image to a collection to shopify with the ruby api gem

我尝试了coll = ShopifyAPI :: SmartCollection.find(id)coll.image = {“ src” =>“ ...”}和不计其数的其他方法-似乎无济于事

The Shopify API docs provide an example of how to update the SmartCollection image:

collection = ShopifyAPI::SmartCollection.find(id)
collection.image = { attachment: "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\n" }
collection.save

The attachment should be base64 encoded.

It should also be possible to specify a src where Shopify should download the image.

collection = ShopifyAPI::SmartCollection.find(id)
collection.image = { src: "http://example.com/rails_logo.gif" }
collection.save

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM