Loyalty Points

Loyalty points are points awarded to a customer as a part of a loyalty program, in an effort to encourage customers to continue using the shop or service associated with the loyalty program.

In Dynamicweb, loyalty points can be awarded to customer whenever they purchase something in your shop, and you can implement ways for them to spend their loyalty points – either through your regular product catalog or by creating a separate Loyalty Points Shop with a select subset of products.

In this article we will cover the following:

  • Creating Reward rules and triggers for awarding them
  • Adding a price in points to select products
  • Implementing ’buy with points’ in the shopping cart app
  • Customizing the loyalty point lifetime

Enjoy!

Reward rules are used to define a reward and a set of triggers for awarding the, erh, award. So a reward rule could be ’2%’ and the trigger(s) could be ’Buys for more than 1000 DKK’ or ’buys one of X products’.

To create a reward rule:

  • Go to Ecommerce > Loyalty Points
  • Click New in the toolbar to open the edit reward view (Figure 2.1)
Figure 2.1 The rewards overview

First, define the reward:

  • Name the reward
  • Select a reward type – either fixed or percentage
  • Enter either a fixed point reward or a percentage reward
  • Select a currency on which to calculate the reward – i.e. you want to give 10% of 100 USD in points, not 10% of 100.000 Turkish lira
  • Select a rounding method - this is to avoid awarding fractional points

Typically a solution has only a few reward rules – 2%, 5%, and 10% for instance – and then triggers are added and removed as you see fit.

Next, define the triggers for handing out the award – click Add rule to open the Edit rule interface (Figure 2.2):

Please note that triggers are evaluated on an orderline basis

Figure 2.2 Creating a trigger

As you can see from the screenshot above, rules can be simple or complicated – it all depends on the scenario at hand. For instance, a simple Christmas campaign rule just needs to be Active from e.g. December 1st to December 25th.

But you can also limit who can trigger the rule in several ways:

Group

Trigger name

Effect

Users and Groups

User

Rule only triggers for this user

 

User group

Rule only triggers for users in this user group

 

Customer number

Rule only triggers for users with this customer number

Product quantity

Product quantity

Rule only triggers when more than this number of products are being bought

Total price

Condition

Specifies a condition – like greater than or equal to – qualifying the Total Price field

 

Total price

Only orders which match this number & the condition in the previous field trigger the rule

Product catalog

Shop

Only products in this shop trigger the rule

 

Language

Only products in this language trigger the rule

 

Products and/or groups

Only the following products and/or product group trigger the rule

Order

Country

Only orders from the Ecommerce country trigger the rule

 

Shipping

Only orders using this shipping method trigger the rule

 

Payment

Only orders using this payment method trigger the rule

Fields & Vouchers

Order field

Only orders with a value in this order field trigger the rule – can be a coupon field, a voucher field or list, etc.

In frontend you can use Ecom:Product:Reward tags to show how many points a customer can earn by purchasing a product. The Product.ConditionRewards loop allows you to show which conditions are required to triggger a particular rule.

In addition to awarding points via rules, you can add loyalty points to a user manually:

  • Go to the Users area and locate the user.
  • In the ribbon bar, click the Loyalty points button to open the loyalty points overview (Figure 3.1)
  • Click Click here to add a new transaction to add points – and optionally a comment about the transaction – to the user
Figure 3.1 Viewing the loyalty points transaction details for a user

From the loyalty points overview, you can also view all points transactions for the user, e.g. the expiry date of points awarded on the basis of orders, any points awarded manually, and the OrderIDs of transactions involving points.

To make points useful, you should allow users to buy products with points – and that requires you to give one or more products a price in points.

To do so:

  • Go to Ecommerce > Product Catalog and locate the product(s) you want make purchasable with points
  • Open the product details and locate the Loyalty Points price field
  • Enter a loyalty points value for the product(s)

Once you’ve added a loyalty point value to the product(s) you want to, you must allow your users to check out and pay using loyalty points.

To do so, you must modify your shopping cart templates – read more in the implementing section of this document.

To allow your customers to buy and check out using loyalty points (Figure 5.1), you must modify your shopping cart templates.

Figure 5.1 You must allow your customers to add products to the shopping cart with loyalty points

To do so:

  • Go to the paragraph with your product catalog app and open the app settings
  • In the templates section:
    • Modify the product template to render a ‘buy with points’ button. See ProductLoyaltyPoints.html for an example.
    • Modify the product list template to render a ‘buy with points’ button. See ProductListLoyaltyPoints.html for an example.
    • In both cases, you can create your own implementation using the cartcmd addwithpoints.

Once completed, a customer wishing to add a product to the shopping cart must choose between paying with points or with money. Selecting points initiates a points balance validation procedure, checking that the customer has enough points to buy the product.

Once the checkout flow is begun, we validate that the customer has enough points to pay for all products added with point. When the order is complete, the points total is withdrawn from the customer’s point balance.

Discounts, taxes and loyalty points 2.0

Discounts and taxes are not calculated for order lines paid with loyalty points.

By default, loyalty point transactions may themselves trigger new loyalty point awards – but you can overrule that.

To do so, you must go to Settings > Ecommerce Advanced configuration > Loyalty points and check "Disallow rewarding points from products purchased with loyalty points". Read more about the settings here.

Loyalty points have their own dedicated app– called Loyalty Points – which can display loyalty point transactions in frontend to logged-in users.

Here’s how to set it up:

  • Find an appropriate location for the app - typically a Profile page for logged in users
  • Create a paragraph and add the Loyalty Points app (Figure 6.1)
Figure 6.1 The loyalty points app
  • In the templates section, create or modify the templates to suit your purpose – see the list.html and details.html templates for examples
  • Select a paging and a sorting setting
  • Save your setup

You can now go to the frontend and login with a user to view a list of loyalty point transactions (Figure 6.2) (if any) for that user.

Figure 6.2 Listing the loyalty points transactions in the frontend

By default, loyalty points are valid forever and ever.

If, however, you want to make them valid only for e.g. six months, you must:

  • Go to Settings > Ecommerce > Advanced configuration > Loyalty points
  • Specify for how many months you want the loyalty points to be valid (Figure 7.1)
Figure 7.1 Customizing the loyalty points expiration period

Read more about the Advanced configuration settings here.

database

These are the database tables associated with the Loyalty Points feature:

EcomLoyaltyReward

Contains reward setup from the Ecommerce -> Loyalty points node.

Field name Data type Length
LoyaltyRewardId int 4
LoyaltyRewardName nvarchar 50
LoyaltyRewardType int 4
LoyaltyRewardActive bit 1
LoyaltyRewardPoints float 8
LoyaltyRewardCurrencyCode nvarchar 3
LoyaltyRewardRoundingId nvarchar 50
LoyaltyRewardPercentage float 8
LoyaltyRewardArchived bit 1

EcomLoyaltyRewardRule

Contains setup for individual rules in a loyalty point reward. Linked on LoyaltyRewardRuleRewardId.

Field name Data type Length
LoyaltyRewardRuleId int 4
LoyaltyRewardRuleRewardId int 4
LoyaltyRewardRuleShopId nvarchar 255
LoyaltyRewardRuleGroupId nvarchar 50
LoyaltyRewardRuleProductId nvarchar 30
LoyaltyRewardRuleProductVariantId nvarchar 255
LoyaltyRewardRuleProductLanguageId nvarchar 255
LoyaltyRewardRuleName nvarchar 255
LoyaltyRewardRuleActive bit 1
LoyaltyRewardRuleValidFrom datetime 8
LoyaltyRewardRuleValidTo datetime 8
LoyaltyRewardRuleAccessUserId int 4
LoyaltyRewardRuleAccessUserGroupId int 4
LoyaltyRewardRuleAccessUserCustomerNumber nvarchar 255
LoyaltyRewardRuleProductsAndGroups nvarchar Max
LoyaltyRewardRuleCountryCode2 nvarchar 2
LoyaltyRewardRuleShippingId nvarchar 50
LoyaltyRewardRulePaymentId nvarchar 50
LoyaltyRewardRuleProductQuantification int 4
LoyaltyRewardRuleProductQuantity float 8
LoyaltyRewardRuleOrderTotalPriceCondition int 4
LoyaltyRewardRuleOrderTotalPrice float 8
LoyaltyRewardRuleOrderFieldName nvarchar 255
LoyaltyRewardRuleOrderFieldValue nvarchar Max
LoyaltyRewardRuleVoucherListId int 4
LoyaltyRewardRuleOrderLineFieldName nvarchar 255

EcomLoyaltyRewardTranslation

Contains translations (LoyaltyRewardTranslationLanguageId) of loyalty point rewards (LoyaltyRewardTranslationRewardId).

Field name Data type Length
LoyaltyRewardTranslationAutoId int 4
LoyaltyRewardTranslationRewardId int 4
LoyaltyRewardTranslationLanguageId nvarchar 50
LoyaltyRewardTranslationName nvarchar 50

EcomLoyaltyUserTransaction

Logs loyalty points awarded to users (LoyaltyUserTransactionUserId). Which rule triggerede the award (LoyaltyUserTransactionRewardId) and which order triggerede the rule (LoyaltyUserTransactionObjectElement).

Field name Data type Length
LoyaltyUserTransactionId bigint 8
LoyaltyUserTransactionUserId int 4
LoyaltyUserTransactionRewardId int 4
LoyaltyUserTransactionDate datetime 8
LoyaltyUserTransactionPoints float 8
LoyaltyUserTransactionObjectType nvarchar 255
LoyaltyUserTransactionObjectElement nvarchar 255
LoyaltyUserTransactionComment nvarchar 255