Get Started with Shopify

December 12, 2016
admin

Contributor: Jumayel Islam, Nascenia

  • Shopify is one of the best designed and most feature-packed of the cloud-hosted ecommerce solutions out there.
  • Shopify is an amazing platform for building an online retail business.
  • Currently 275,000 stores use the platform and now that their online offering is solid, Shopify has begun tackling offline retail with their POS system.
  • It may be different to what you’ve used before because it’s a hosted solution, which means Shopify host your shop on their servers and you don’t have access to the back-end code. For most retailers that’s not a problem, as you can still massively customise your shop via configuration, ‘apps’ or by customising your theme.
Benefits:

1. Responsive Website:

‘Themes’ are how you define how your store looks. Shopify provides you with several free default themes when you signup – these can be easily customised by adding your logo, changing colours and choosing fonts.

You can make more comprehensive changes to the templates if you have a good understanding of CSS, HTML and Liquid. Liquid is Shopify’s proprietary language for creating themes for their platform. This allows you to completely manipulate the theme, creating a custom look and feel that is unique to your brand.

If you don’t have these skills, the best thing to do is employ a Shopify Expert to customise them for you. Even if you can code yourself, sometimes it’s still worth hiring someone to do it, so you can focus your time elsewhere.

You can also buy premium themes, which tend to be of better quality and most include a support email address to help you get up and running.

2. No Tech Worries:

Hosting an ecommerce website is hard, you have to deal with ensuring:

  • Your servers are secure and up to date with the latest software.
  • You are fully PCI compliant, especially if you plan to take payments through your own checkout.
  • Your website responds quickly, making use of caching, CDNs and other techniques
  • Your website is backed up on a regular basis

Like BigCommerce and Volusion, Shopify host their own websites, so there’s none of these concerns.

In most cases Shopify is going to be able to provide faster and more secure hosting than you can do on your own.

You also don’t have to worry about scalability because even if you suddenly receive a spike in traffic, it’s a drop in the ocean when you consider there are 120,000 other stores on the platform.

3. 24/7 Customer Support

4. Easily add powerful features from App Store

This is one of the most useful elements of Shopify. They have an App store full of third party apps that you can purchase to add functionality to your store.

5. Import Large Product Catalogues Quickly

6. Plenty of Payment Gateways to Choose from

7. Some other benefits:

– Minimal set up effort/cost.
– Easy to use admin screens including order management.
– In built marketing/SEO tools like coupon codes and editable meta-descriptions.
– No PCI compliance concerns.
– No hardware/hosting worries.
– Access to a superfast platform, beneficial for user experience and SEO.
– Competitive pricing, especially if you use Shopify Payments.

Making Shopify Apps:

Shopify’s API provides an almost unlimited set of possibilities for interfacing the Shopify platform with third-party software.

There are two ways you can make money building apps for Shopify stores:

1. Create a custom app for a client: Use the Shopify API to build and sell an app that adds features and functionality to a client’s Shopify store.

2. Build an app and sell it in the Shopify App Store: You’ll earn 80% of each app sale.

Get Started:

To start developing your app, you need to become a Shopify Partner by registering here for your free Shopify Partner account. As a Shopify Partner, you gain access to the Partners dashboard where you can create Development Stores. Development Stores are an area for app development where you can create data to test out the functionality of your app. To create a Development Store:

1. Log in to your Partners dashboard
2. Click Development Stores in the sidebar.
3. Click Create a new store.

Install your app into your Development Store:

Shopify’s API implements JSON to manipulate each API resource in isolation, providing a RESTful interface. All API usage happens through Shopify apps created by either store owners for their own shops, or by Shopify Partners for use by store owners.

Any Shopify app that you create will use the Shopify API to access another shop’s data and automate almost any action from their shop admin dashboard. When a shop installs your app, all they’re really doing is giving your app permission to access their shop’s data through the API.

To properly install your app, you will need to provide your app with an authentication mechanism. Authentication mechanisms allow your app to interact with other Shopify stores. Shopify uses OAuth 2.0 as its primary authentication mechanism.

Shopify API reference:

A comprehensive reference guide to the complete Shopify API:
https://help.shopify.com/api/reference

Creating Shopify App using Ruby on Rails:
Quickstart:

Check out this screencast on how to create and deploy a new Shopify App to Heroku in 5 minutes.

Prerequisite:

Once you have a Partner account create a new application to get an Api key and other Api credentials. To create a development application set the Application Callback URL to:

http://localhost:3000/

and the redirect_uri to:

http://localhost:3000/auth/shopify/callback

This way you’ll be able to run the app on your local machine.

Create Rails Application:

We will use shopify_app gem to get the basic configuration to build our first shopify app using Ruby on Rails.
To get started add shopify_app to your Gemfile and bundle install

# Create a new rails app 
$ rails new my_shopify_app 
$ cd my_shopify_app 
# Add the gem shopify_app to your Gemfile 
$ echo "gem 'shopify_app'" >> Gemfile 
$ bundle install
Default Generator:

The default generator will run the install, shop, and home_controller generators. This is the recommended way to start your app.

$ rails generate shopify_app --api_key <your_api_key> --secret <your_app_secret>

Now you will need to configure few things in shopify_app.rb file in my_shopify_app/config/initializers directory.

Options include:
scope – the Oauth access scope required for your app, eg read_products, write_orders. Multiple options need to be delimited by a comma-space. Ex:

config.scope = 'read_orders, read_products, write_products, read_themes, write_themes'

embedded – the default is to generate an embedded app, if you want a legacy non-embedded app then set this to false. Ex:

config.embedded_app = false

This generator creates a simple shop model and a migration. It also creates a model called SessionStorage which interacts with ShopifyApp::SessionRepository.

Note that you will need to run rake db:migrate at this point.

This generator also creates an example home controller and view which fetches and displays products using the ShopifyAPI. You can later modify it according to your need.

Mounting the Engine:

Mounting the Engine will provide the basic routes to authenticating a shop with your custom application. It will provide:

shopify

The default routes of the Shopify rails engine, which is mounted to the root, can be altered to mount on a different route. The config/routes.rb can be modified to put these under a nested route (say /app-name) as:

mount ShopifyApp::Engine, at: '/app-name'

This will create the Shopify engine routes under the specified Subdirectory, as a result it will redirect new consumers to /app-name/login and following a similar format for the other engine routes.

Using Shopify API:

ShopifyAPI uses ActiveResource to communicate with the REST web service. ActiveResource has to be configured with a fully authorized URL of a particular store first. To make authenticated API requests you need to set the base site url as follows:

shop_url = "https://#{API_KEY}:#{SHOPIFY_TOKEN}@SHOP_NAME.myshopify.com/admin" 
ShopifyAPI::Base.site = shop_url

API_KEY: This is the key generated when you created your app in partner’s account.
SHOPIFY_TOKEN: This is the token stored in your shop table when the app is installed for a particular shop.

Now you can make your API requests. Some sample API requests have been listed below:

shop = ShopifyAPI::Shop.current
# Returns shop object which contains store information

products = ShopifyAPI::Product.find(:all)
# Returns all the product objects from the store

ShopifyAPI::Webhook.create({ topic: 'orders/create', address: [ENDPOINT_URL], format: 'json' })
# Creates a webhook

You can find out the Shopify API documentation here:

https://help.shopify.com/api/reference

2 Comments. Leave new

Shopify is great but thats not free !
did you try spree ecommerce??

Reply

Yes. It’s not free. But the packages are very competitive compared to other e-commerce platforms. Spree ecommerce is good too, they have a solid API documentation, though I haven’t yet worked on it.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.