1. What is Shopify?
Shopify is a complete e-commerce solution that allows you to set up an online store to sell your goods. It lets you organize your products and customize your storefront. Shopify also integrates with an existing website or a domain name registered with another provider. It comes packed with over 100 templates that you can apply to your e-commerce shop. New designs are added all the time. You can customize the look of your store with a graphical interface. Liquid is the e-commerce template language used by Shopify and we can discuss it in later in this document.
The only difference between Shopify and other e-commerce solutions like Magento or Prestashop is that you don’t have to install anything by yourself. Every store is hosted by Shopify. But you can use a custom domain if you want.
For more information Please visit:- https://www.shopify.in/faq/what-does-shopify-do
2. Application Development steps
2.1 Register a Shopify Partner Account.
The first thing that you need to do is to register a Shopify Partner Account. This will allow you to create apps for Shopify. For registering as Shopify Partner Account got to the link:-https://app.shopify.com/services/partners/
2.3 To Create a Dev Shop
For checking the app we can create a test shop. Real Shopify Shops has no time restrictions and all the functionality of a normal shop is also available.The only difference is that a Dev Shop cannot accept payments. Although Shopify has provided a bogus payment gateway so developers can still test out the actual checkout process even when using a Dev Shop.
2.4 Installing the Dependencies
Develop the app. To make things easier we will be using a library that will interact with the Shopify API. It will help you a lot if you are capable of access and process the API or curl calls in your idea then it’s not necessary.
Here is an example
2.4.a: Create a composer.json with the following code.
If you haven’t already installed Composer, go ahead and install it by executing the following command from the terminal:
curl -s http://getcomposer.org/installer | php
then the php composer.phar install
2.4.b: Create Database
We can create databases to store the app details, user details…etc
Mainly we want to store ‘api key’,’redirect_url’, ‘permissions’, and ‘shared_secret’ in the app details related table. Below given is the table creation query which uses the above method.
CREATE TABLE IF NOT EXISTS `tbl_appsettings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`api_key` varchar(300) DEFAULT NULL,
`redirect_url` varchar(300) DEFAULT NULL,
`shared_secret` varchar(300) NOT NULL,
PRIMARY KEY (`id`)
List of Permission/scopes:
- read_content, write_content : Access to Article, Blog, Comment, Page, and Redirect.
- read_themes, write_themes : Access to Asset and Theme.
- read_products, write_products : Access to Product, product variant, Product Image, Collect, Custom Collection, and Smart Collection.
- read_customers, write_customers : Access to Customer and Saved Search.
- read_orders, write_orders : Access to Order, Transaction, and Fulfillment.
- read_script_tags, write_script_tags : Access to Script Tag.
- read_fulfillments, write_fulfillments: Access to Fulfillment Service.
- read_shipping, write_shipping : Access to Carrier Service.
- read_analytics : Access to Analytics API.
- read_users, write_sers : Access to User SHOPIFY PLUS.
Also, we can keep a table contains the details about the app using users and it contains an access token and corresponding store name where access token is used as the permanent access token associated with the store to be used when authenticating API requests.
Here given below the table structure or query used for above Dependencies.
Use the query:
CREATE TABLE IF NOT EXISTS `tbl_usersettings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`access_token` text NOT NULL,
`store_name` varchar(300) NOT NULL,
PRIMARY KEY (`id`)
If the app needs more tables we can create with apps needed.
2.4.c After all this we can Create an app (Ref:2.2) and to install the app with test mode you can call it with an url that contain API key
If we receive this call, then we must send a response as in the form
After this successful response, we can show the installation window in Shopify admin panel
Click on install button to receive API call with parameters of code, hmac, shop, timestamp. With the parameters, we can collect the access token and save it on our DB and with the above details, we can install the app to the store with the curl/api call, In older version they use signature for validation now days its changes to hmac
In the installation process, we can add js and edit theme files. we can create pages and lot off, and the installation procedure is described below.
3.Steps to Add on during installation
In the installation process, we can use Curl for calling to Shopify here below given the common headers using for the calls for our needs.
$json = json_encode($data); //we can describre $datas as an array the values need to pass
$ch = curl_init($init); // $init values are different for different needs that will be given in own parts.
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Length: ' . strlen($json))
3.1 How Can We Install Script tags
The Script Tag resource represents remote java scripts which are loaded into the pages of a shop’s storefront and on the order status page of checkout. This makes it easy to add functionality to those pages without touching any theme templates. When you put a js, it only links the js file in their pages. When we change anything in our js it will reflect in the project.
Always confirm cross domain access to avoid failure of your app
3.2 How can create new pages During installation
3.3 Edit in Theme Files Using Liquid Files
Liquid uses a combination of tags, objects, and filters to load dynamic content. They are used inside Liquid template files, which are a group of files that make up a theme. For more information on the available templates, please see Building themes.
Ref: – for Edit Liquid files :- https://help.shopify.com/api/reference/theme
3.4 Get Order Details
Likewise, we can do many things with shopify with API. The whole things you can refer at: – https://help.shopify.com/api/reference
Note : – After successful installation of app do not forget to call back to the shop admin panel.
Enjoy Shopify !!!!