How Do I Override Shopify Existing Product Image Position With Ruby?
I am using the Shopify API with Ruby and I am trying to understand the flow of posting a new product image into an existing product into position 1 and overriding\rearranging the position of the current image into position 2.
products = ShopifyAPI::Product.find(123456789) products.images << ShopifyAPI::Image.new(:src=> "http://website/CF01.jpg", :position=> 1) products.save
When setting the current image position to 2 it changes the position attribute but not the actual position of the image on the store, even setting the position to nil doesn't work. Do I need to completely remove and re-upload the current image(s) to get the new image in the first position? Should I be trying to access the ShopifyAPI::Image end point instead?
products = ShopifyAPI::Product.find(123456789) products.images.position = 2 products.images << ShopifyAPI::Image.new(:src=> "http://website/CF01.jpg", :position=> 1) products.save
Uploading the image to the product and saving it then changing the position on the first image then the new image and saving again seemed to have worked.
#this is based on a product with 1 image products = ShopifyAPI::Product.find(id) products.images << ShopifyAPI::Image.new(:src=> "http://website.com/image.jpg") products.save products.images.position = 2 products.images.position = 1 products.save
- → Trigger a click with jQuery using link_to of rails 4
- → Adding html data attribute to simple_forms input
- → How to remove parameters from the root URL if it does I18n
- → passing parameters to rails back end from an ajax call
- → Blocking ?page= in robots.txt
- → react js and rails Updating state on a component with active record relationship
- → State not passed into prop
- → Cannot read property 'modalIsOpen' of undefined
- → Objects not valid issue
- → How to map API params to model
- → Consuming webhooks shopify-api
- → How to add ScriptTag on shopify_api gem?