Shopify App Development – How to Create Shopify Apps?

Shopify app development is an opportunity given to developers to help hundreds of thousands of Shopify stores. While doing so, they can earn as much as the entrepreneurs just by building for the Shopify App Store.

What is Shopify?

It’s such an understatement if you say that Shopify is just an eCommerce software. Technically it is, but personally speaking, Shopify is one of the best eCommerce platforms that provides everything you need to start selling not just online, but also on social media and in person.

Shopify is completely cloud-based and hosted, which means there’s no need for you to worry about the servers and such. Just create an account and you’re good to start.

But of course, we’re going to focus more on Shopify app development and why you should build apps.

So…

Why Develop Shopify Apps?

According to Shopify, 87% of Shopify entrepreneurs rely on Shopify apps to run their businesses. Not only that, it is expected to see more growth in the next few years coming.

Shopify apps gaining more growth since 2016

So why not develop Shopify apps when it’s clear that this could be a double win for both parties?

Now you might be asking…

How much does Shopify developers make?

According to Shopify, there are two ways to make money with your shopify apps:

  1. Create Shopify apps for your clients, which means the app is not yours once you have sold them to your clients.
  2. Create Shopify apps for Shopify store and sell them and you’ll earn 80% of each app sale.

On average, you can earn somewhere around $2000 per month. However, this all depends on how much your Shopify app is going to be. It also depends on which category your Shopify app is located.

Average price of Shopify apps per category - How much is Shopify apps?

In the graph given above, if your app is for Inventory or Accounting, then there’s a higher chance that you’ll get more profit because both of these categories are really expensive. So if you’re targeting to earn more money, then building apps for Inventory and Accounting is your best option.

Shopify App Development - What if my app is free?

Good question! What if your Shopify app is free?

How are you gonna make money with that?

There are ways to earn money with free Shopify app, your first option is to divide your app into two versions, first is a standard version which is free, and the other one is the PRO version which is the paid version.

Find Shopify Products with Oberlo

To make your chances of earning higher, make sure your PRO version provides really helpful features.

For example, your app is a dropshipping app. With the free version, you can only let users import 1000 products whereas, in paid version, you can import an infinite amount of products.

Another option is to give the users a number of days trial.

For example, your app can only be free for 14 days. After that, users will need to pay you monthly for the subscription.

All up to you.

But what is recommended? like really?

Well, personally, I like my apps to be free for a couple of weeks and then make them pay for the subscription once they like the app. This way, I can confirm that they will use my apps longer than I expect them to.

You can also combine them.

For example, you can give users 14-day free trial and then ask users for monthly subscriptions and at the same time, they can upgrade their app to PRO plan.

Getting Started

I have written already a complete guide on how to create Shopify apps using PHP. So in this article, I’ll just provide you the summary of it. However, if you’re interested in reading the step-by-step guide. Then I recommend you to follow this link:

To start making your app, login your account to Shopify developer website and if you don’t have an account yet. I suggest you create one.

Once you’re logged in, follow these steps:

Start making your Shopify app with PHP
  1. Proceed to left navigation panel and click the Apps category
  2. Click Create app and fill out the form
    • App Name – The name of the shopify application you’re about to create.
    • App URL – The URL of your website where you’re going to upload your Shopify files
    • Whitelisted Redirection URL(s) – This is where you’re going to list your generate token script or URLs you need as you Authenticate your Shopify.
  3. click Create app

After that, Shopify developer will provide you your API key and Secret key. These two keys are used for authenticating your app to stores.

Shopify API

Next thing you need is an API, like what I have mentioned in my Shopify app development tutorial, you can use different APIs, but personally, I use Shopify API Client made by Alex. It’s very simple and easy to use.

Installing Shopify apps to stores

Next thing you need is the files to connect your app to stores, or let’s just say, let users install your app on their store. In this article, we’re going to use PHP to create the app. So, go ahead and create a new file and call it install.php and copy the following code:

<?php
$shop = $_GET['shop'];
$domain = $_SERVER['SERVER_NAME'];

$api_key = "ASSIGN YOUR API KEY HERE";
$scopes = "read_orders,write_products";

$redirect_uri = "http://".$domain."/token_generator.php";

$install_url = "https://" . $shop . "/admin/oauth/authorize?client_id=" . $api_key . "&scope=" . $scopes . "&redirect_uri=" . urlencode($redirect_uri);

header("Location: " . $install_url);
die();
Code language: PHP (php)

Make sure you change the value of API key to what was given to you by Shopify. Otherwise, the script won’t work.

Generating Token

Next, create a new PHP file and call it token_generator.php and copy the following code:

Keep in mind that both install.php and token_generator.php should be uploaded in the same folder. Unless you want to organize your files then you need to reference it correctly by changing the value of redirect_uri in the install.php file.

<?php
//Include your Shopify API
require_once("inc/functions.php");

//Change the value of these two
$api_key = "ASSIGN YOUR API KEY HERE";
$secret_key = "ASSIGN YOUR SECRET KEY HERE";

$params = $_GET; // Retrieve all request parameters
$hmac = $_GET['hmac']; // Retrieve HMAC request parameter

$params = array_diff_key($params, array('hmac' => '')); // Remove hmac from params
ksort($params); // Sort params lexographically
$computed_hmac = hash_hmac('sha256', http_build_query($params), $secret_key);

// Use hmac data to check that the response is from Shopify or not
if (hash_equals($hmac, $computed_hmac)) {
	// Set variables for our request
	$query = array(
		"client_id" => $api_key, // Your API key
		"client_secret" => $secret_key, // Your app credentials (secret key)
		"code" => $params['code'] // Grab the access key from the URL
	);
	// Generate access token URL
	$access_token_url = "https://" . $params['shop'] . "/admin/oauth/access_token";
	// Configure curl client and execute request
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_URL, $access_token_url);
	curl_setopt($ch, CURLOPT_POST, count($query));
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($query));
	$result = curl_exec($ch);
	curl_close($ch);
	// Store the access token
	$result = json_decode($result, true);
	$access_token = $result['access_token'];
	// Show the access token (don't do this in production!)
	echo $access_token;
} else {
	// Someone is trying to be shady!
	die('This request is NOT from Shopify!');
}
Code language: PHP (php)

Make sure you have downloaded the API provided above and then upload it to your host. Otherwise, you will get an error.

In this file, make sure to change again the value of both api_key and secret_key variables.

Another thing to keep in mind is that you need to personally keep your access tokens to be able to interact with the app. But what if other users did not receive their tokens? The answer is simple, you need to store the access token yourself so they won’t need to do such actions.

I have written an article on how to store these access tokens in two ways. I’m sure you will need this in the future so you might as well learn how to save it. Click the link below to learn more:

Testing the Shopify App

Once everything is set up, you may go to your project URL and run install.php. To do this, you must include the GET variable shop in the URL. For example: 

https://mydomain.com/install.php?shop=mystorename.myshopify.com

After that, hopefully you’ll see something like this:

Installing shopify app to a store using Shopify App Development Tutorial with PHP

There you have it! Your Shopify app is now ready to be built. Of course, it’s not finished yet because you still have to plan what kind of app you want to create.

So if you are interested, I have made a tutorial on how to display Shopify products and its components like prices and such. This could help you understand how to communicate with Shopify API.

Brainstorming Ideas for the App

Whenever I develop Shopify apps, I usually design the app first. What I mean by that is, I set up the app first to make sure that everything is ready for users for installation.

It’s all up to you.

You can also brainstorm first, get ideas about what kind of app you are going to create. Now, keep in mind that there’s no right or wrong here. Just stay in your comfort zone and develop the app.

Now let’s start brainstorming!

For example, you’re planning on developing an app which tells the Shopify store owners about their statistics. Now, you may ask yourself these questions:

  • What is the purpose of this app?
  • What features are you going to add in this app that has not been added by your competitors?
  • How much is this app going to be?
  • How much is my budget?
  • Where am I going to promote this app? and How?
    and last but not least…
  • How long is my development going to be?

It is very important to know the answers first for the questions above. That way, you will understand your app better than anyone else.

Recommendations

Whenever you develop a Shopify app, you may do the following especially if you want conveniences:

  • List all your app features
  • Create a dummy store
  • Add more useful stuff as much as possible
  • Prevent yourself from making a private app
  • Do research (Lots of research). We offer a ton of tutorials for Shopify app development
  • Most importantly: Test your app always!

It is highly recommend to double check every single part of the app especially if you’re planning on publishing the app to the Shopify app store.

1 Comment.

Leave a Reply