May 15, 2020
10 minute read
Shopify Apps using ROR

What is Shopify?

Nowadays e-commerce is using more and if you want to set up your online store then as a quick setup and solution Shopify will come in mind. It allows to sell merchants to their own products even it is physical or digital products. With Shopify merchants can build there own brands to be sold on their name rather than online shopping platforms like Amazon, eBay, Flipkart, and more. Shopify is reducing the time of store setup as well as it brings less interaction with a technical person so cost saving will be also managing with fast store setup.

What is Shopify Apps?

As you all know Shopify is built with Ruby on Rails. so it is better to create Shopify apps with ruby on rails. Shopify Apps will be used in any Shopify store as a plugin where merchants want to enhance their store in terms of functionality. They don’t need an extra technical team to build the functionality of what they needed and save time. They can use existing Shopify Apps from the Shopify App store and if they want any private apps then also merchant will create with help of Shopify App Development team.

How to create Shopify Apps with Ruby On Rails?

Create Shopify Apps with ROR

To create the Shopify app, you need to follow these steps

  1. Create a Shopify Partner account 

  2. Once you create that, you will need to create a custom Shopify app within the partner dashboard

  3. Setup URLs within the app. Here local machine URL like localhost will not work so you need ngrok or another tunneling software like ssh, localtunnel, and more.

  1. Get the API key and API secret key from the app.

SSL certificate is required if you are using your own domain after deployment on the server. (Make sure you use https://)

Now let’s create Ruby On Rails application and integrate Shopify app gem within it for create Shopify apps

Create a new rails application with

                $ rails new my_shopify_app

Then open the Gemfile and add Shopify app gem into it

                $ gem 'shopify_app'

Then install the gem with a

                $ bundle install

This gem includes default generators like install, shop, and home controller.
This is the recommended way to start a new app from scratch:

                $ rails generate shopify_app

After generating generators, add new tables in the database with the command

                $ rake db:migrate

After that setup API key and API Secret into the rails app. Set both keys as an environment variable and add this in shopify_app.rb file:

                ShopifyApp.configure do |config|
   config.application_name = "Example app"
   config.api_key = ENV['SHOPIFY_APP_API_KEY']
   config.secret = ENV['SHOPIFY_APP_SECRET']
   config.scope = "read_products, read_orders, read_customers, write_customers, read_orders"
   config.embedded_app = true
   config.after_authenticate_job = false


  • if you don’t want your app embedded with Shopify then make 

                config.embedded_app = false
  • scope means whatever permission you need from Shopify to get access data into Shopify apps. Make sure you can ask only that permission which you needed.

You can install this app on your store with URL which you have created with tunnel link(ngrok or other which you have used) after starting rails server with rails s

It will ask for shop_domain where you want to install this app like this. So enter your shop domain and install the app.

dded with Shopify then make


Now you can enjoy your Shopify app and play with that with different products, customers, orders, theme customization, etc.

During the installation of the app into your store, you can create some default webhooks as well which you needed in your app using Shopify API.

You just need to add this snippet into shopify_app.rb file

                ShopifyApp.configure do |config|
  Config.application_name = “Example app”
  topics = %w[app/uninstalled orders/create orders/delete]
  config.webhooks = topics.each_with_object([]) do |topic, a|
    options = {
      topic: topic,
      format: "json", 
      address: "https://#{your_domain}/webhooks/#{topic.parameterize(separator: '_')}"

If you don’t want to create a default webhook while app installs, then you can use this code to create webhooks within code anywhere.

                topics = %w[app/uninstalled orders/create orders/delete]

shop.with_shopify_session do
  topics.each do |topic|
       topic: topic,
       format: "json",
       address: "https://#{your_domain}/webhooks/#{topic.parameterize(separator: '_')}"

If you get any questions during the creation of the Shopify app then please contact us.

Sachiin Gevariya

Sachin Gevariya is a Founder and Technical Director at Essence Solusoft. He is dedicated to making the best use of modern technologies to craft end-to-end solutions. He also has a vast knowledge of Cloud management. He loves to do coding so still doing the coding. Also, help employees for quality based solutions to clients. Always eager to learn new technology and implement for best solutions.