A technical deep-dive into creating loyalty and rewards programs with Shopify

Loyalty programs are a ubiquitous part of your shopping experience, if you are a customer you are probably already using Amazon Prime or Starbucks rewards and are often subconsciously making purchase decisions based on which stores you have rewards for and where you get the most discounts for your purchase, if you are a merchant you are either already using some kind of rewards program or looking into to creating one for your store.

This article is intended for e-commerce vendors and developers to help them better understand how customer rewards programs work and how you can create their own rewards interactions using Shopify discount and price-rules APIs. We also introduce Loyaltyplex, a tiered loyalty system allowing you to create easy to redeem, tiered rewards programs and incentivize your customers to spend more and come back often to make repeat purchases.

As an e-commerce vendor, you probably often find yourself competing with mega-corps such as Amazon and Target and know the customer acquisition is the bulk of your operational expenses, when running ad campaigns such as Google Adwords or Facebook/Instagram campaigns the costs to acquire new customers can get prohibitively high and once you acquire a customer you want to do everything you can to make sure that the customer keeps coming back to your store. Rewards programs are how you can keep customers coming back to your store and not go buy at a competitor's store.

According to a Bain and Company survey 60-80% of customers who are satisfied with a business never return again and therefore a loyalty program that works is the only way to guarantee your store's success in ensuring that once a customer makes a purchase at your store they come back when they need to make another one. As the saying goes-

“Make new friends, but keep the old. One is silver, the other gold.”

Customer retention through loyalty and incentives is perhaps the most sure-fire way to to get repeat customers. The basic principle behind loyalty programs is to keep the customers hooked . The best programs will include gamification of customer engagement and make shopping a more fun experience. For vendors looking to implement a rewards program, thankfully platforms like Shopify make it super simple and intuitive to create your desired Loyalty program implementation via API driven rules and automation.

Let's now look at the basic types of loyalty programs that you can create for your store and the various ways which you can use Shopify APIs to automate innovative loyalty programs and rewards.

Types of loyalty programs-

Loyalty programs have gotten more innovative over the years, but most e-commerce reward program implementations broadly fall into the following four categories.

Membership based rewards-

This is the most commonly found loyalty program which allows you to enroll in a membership program which entitles you to certain benefits such as cash-backs and discounts on a purchase. Walmarts membership card, airline miles rewards programs fall under this umbrella of rewards program which users of the program get specific discounts on subsequent purchases.

Occasion based rewards-

When a customer creates an account on your store and gives you their personal information, you can create rewards such as cash-back or free gifts on occasions such as their birthday or wedding anniversaries. These discounts are often then sent to customers via emails which includes a discount coupon they can redeem over their next purchase or a unique link which applies the discount to their purchases.

Activity based rewards-

These are rewards that can be created on the fly based on customer activity, such as if a customer has items in abandoned checkout you can create a special discount for the user and send them, other use-cases include creating timed rewards that expire after a certain period of time thus creating a sense of urgency and scarcity for instance such as an 5% off for the next 30 minutes.  

Tiered reward programs -

This kind of loyalty program creates tiers and the incentives get better as you the customer climb up the rewards  ladder.

For instance for a particular tiered program, a bronze member may get 3% cash-back while a Gold member may get 5% cash-back. Programs such as this not only provide cash-back to customers on each purchase but also incentivizes them to hold on to their rewards and shop more at your store in order to climb up the rewards ladder in-order to get higher discounts in future purchases.

Rewards and Discount program creation through Shopify

The latest versions of Shopify APIs provides you with two Discount APIs that when combined, allows you to create all of the above types of customer retention programs and more.

Earlier versions of Shopify API exposed discounts only to Shopify Plus customers, meaning apps operating on normal Shopify stores providing rewards creation functionality had to delete  products from a customer cart on the fly and replace them, with lower price variants also created on the fly. Implementations such as these worked but were often complex and a nightmare for sales audit and bookkeeping. However last year Shopify released their price rules and discounts api which made the process of creating rewards much more streamlined.

Using an app-based rewards system allows you two create complex loyalty logic which can be triggered by customer interaction. Let's take a look at the technical aspects of the Shopify discount APIs and how you can create some of these rewards programs.

Price Rules API

The Shopify Price Rules API lets you create rule based discounts which can be applied as a fixed percentage discount, a fixed amount discount or free shipping based discount on an order.  Furthermore the API allows  you to specify entitlement and prerequisite logic for the price rule to be applied allowing you to create engaging rewards based on customer activity.

Once the price rule has been created, you can then create discount coupons by calling the discount coupon id.

POST /admin/api/2019-10/price_rules.json
  "price_rule": {
    "title": "SUMMERSALE10OFF",
    "target_type": "line_item",
    "target_selection": "all",
    "allocation_method": "across",
    "value_type": "fixed_amount",
    "value": "-10.0",
    "customer_selection": "all",
    "starts_at": "2017-01-19T17:59:10Z"

Discounts Code API

Once a price-rule has been constructed, you can then create discount coupon by calling the price-rule API with the created price-rule ID.

POST /admin/api/2019-10/price_rules/#{price_rule_id}/discount_codes.json
// Response
  "discount_code": {
    "code": "SUMMERSALE10OFF"

In order to create a smoother rewards redemption experience, the discount codes can then be applied to a customer checkout via either script injection into the UI, or by automatically applying the coupon to the cart via webhook. Other interactions may include sending emails to the customer with discount coupon etc.

A rewards program that works can transform store profit margins and help differentiate you from competitors

Loyalty programs can absolutely increase customer retention and are a must for small e-commerce stores that do not want to hemorrhage money on ads for customer acquisition. Furthermore a good loyalty program will increase your brand awareness and perceived brand value in the eyes of your customer.

Supercharge your rewards program.

If you are a merchant looking to create a Rewards program that can lower the cost of customer acquisition and increase sales for your store, you should absolutely check out Loyaltyplex, It is a free to install Tiered loyalty program for your store that allows you to create gamified rewards and has a slick storefront plugin which allows your customers to view and redeem their rewards with a single click. You can also modify your plugin to match your store theme and see loyalty metrics and analytics right in the Shopify admin dashboard.

About Us

At Kashmere Labs, we provide custom store and app development services for Shopify merchants. If you are a merchant looking for  best in class solutions for creating a new store or adding functionality for existing one, you can request a quote or book a meeting with us here.