If you already have a private app setup in a rails environment, skip the first step and go into your rails console.
If you don’t have a rails environment but you’re running on a mac or linux environment, you may already have ruby installed and all you have to do is install the shopify_api gem and enter into the shopify console environment with the following:
1 2 3 |
gem install shopify_api shopify add [SHOPIFY_SHOP] |
Once you fill in the answers to the questions for credentials you can run
1 |
shopify console |
Now that we’re in the same environment, we can instantiate our session and add our ShopifyAPI module and find and update our products
1 2 3 4 5 6 7 8 9 10 11 |
//Add shopify module include ShopifyAPI //Instantiate our site Base.site = "https://[SHOPIFY_SHOP_API]:[SHOPIFY_PASSWORD]@[SHOPIFY_SHOP].myshopify.com/admin" //Select all products in store products = Product.all //Select only products with a price of zero zerop = products.select {|p| p.variants.any? {|z| z.price == '0.00'}} |
That’s it! Now you can use the variable to update any product field you desire.
Start your shop on shopify today! (My referral link)