Earning Rules

Earning Rules define ways for customers to earn points.

To create a new Earning Rule, go to the Marketing > Promotions > Reward Points > Earning Rules and press the button Add New.

Edit page of an earning rule is very complex and differs depending on type of the rule, so each type has its own subsection here:

If you wish to create custom earning rule, please, refer to Custom Behavior Rules section of this manual.

General Information


These options are common to all types of earning rules.

  • Rule Name - name of the rule. Used only for internal purposes.
  • Display Name - is the rule description for your customers. It will be displayed in the client's account, thus bringing a client the valuable information on the rule (way) to earn the points on your store.
  • Type - the type of rule. There are following types of rules:
    • Behaviour Rule - points can be earned for customer's actions.
    • Product Rule - points can be earned for buying specific products.
    • Cart Rule - points can be earned for cart amount or contents.
  • Is Active - rule status.
  • Active From, Active To - period of rule activity.
  • Customer Groups - customer groups for which rule can be applied.
  • Stop further rules processing - if enabled, no other rules will be applied, if this one applies. Please, see important note below for details.
  • Priority - order which will be used for rule sorting before applying.

Note

Important: It is common case, when different policies shall be applied on the mostly same conditions (or the same event), but with some differences - which require applying only one rule per order. Then Priority and Stop further rules processing options shall be used for organizing their execution order.

Example

For example, regular customer shall receive 10 points, but VIP shall receive 100.

Let's have two rules for that - "Regular" and "VIP" In this case VIP rule shall have higher priority, and has option Stop further rules processing enabled. Then, when VIP customer will buy, the VIP rule will apply, but Regular will not (since option Stop processing... is set). When Regular customer buys, VIP rule will be skipped, and Regular rule will apply normally.

Each rule has four possible global modes of applying conditions in respective Conditions tab, shown in special header If *[apply mode]* of these conditions are *[validation mode]*:

Applying modes define, when rule shall be triggered:

  • ALL - implies, that rule will be executed only when strictly all conditions were met;
  • ANY - implies, that rule will be executed only when one or more (but not all) of conditions were met;

Validation modes define, which result can produce each condition to be counted as "met":

  • TRUE - implies. that conditions should be valid.
  • FALSE - implies, that conditions should be invalid.

These modes allow to create flexible condition sets to satisfy policy of any complexity.

Product Rules


These rules award points for buying a particular product. This type of rule is recommended when products are presumably simple and have fixed prices.

If you wish to include shipping and handling fees to points calculation, but still filter products, you need to use Cart rule with Product attribute combination mode.

Conditions

This section define either single condition or their set, which trigger the rule. They all must be placed inside global mode definition, as described in General subsection.

Each condition has the same scheme: [property] [operator] [check value]

  • Property is the product attribute, that shall be checked;
  • Operator is the type of check, that should be performed to validate rule. There are the following operators available:
    • is - arithmetic operator of equality (==)
    • is not - arithmetic operator of non-equality (!=)
    • equals of greater then - arithmetic operator >=
    • equals or less then - arithmetic operator <=
    • greater then - arithmetic operator >
    • less then - arithmetic operator <
    • contains - special operator, which works differently. If check value is an array (should display as drop-down menu), then operator will search for check value in this array. If value is string, or can be evaluated to string, operator will treat check value as a substring to find.
    • does not contains - the same as above, but with negative result
    • is one of - special operator, which works with user-defined comma-separated array as check value. If this operator used, then condition is valid, when actual value of property exists in defined array. If property itself is a selection-type (SKU or Category, for example), then dialog popup will appear to select elements of user-defined array.
    • is not one of - the same as above, but with negative result
  • Check value is value, to which will apply operator, selected in previous step.

Below you will find a short list of all conditions, currently supported by our extension:

  • Product Properties, available by default

    Generally, their list resembles properties, that are set for Products on particular store. If you will create a custom field for Product, or use extended properties list, they also shall be available in rules.

    • Attribute Set - product attribute setup, created at Catalog -> Attributes -> Attribute Sets
    • Category - category, under which this product is listed. When you need to check for more than one category, use is one of operator in condition.
    • Product Type - allows to check for certain type of product, placed to the cart. Can take the following values:
      • Simple;
      • Virtual;
      • Bundle;
      • Downloadable;
      • Grouped;
      • Configurable.
    • Quantity - quantity of items of this product, placed to the cart;
    • SKU - SKU of product. Selection-type property.
    • Pattern - pattern, used in this product. Included here as an example of extended product property.
    • Performance Fabric - extended property, used only for fabric-type products. Included here as an example of extended product property.
    • Activity - area of usage of particular product
    • Sale - whether product is on sale. In fact is a boolean property, but is a selection Yes/No type. Also included as an example of extended property.
    • Size - size of particular item of product. Is a numeric value, and can be cast to a string.
    • Base Image - base image of the product
    • Base Image Size (bytes) - base image size
    • Small Image - small image of product
    • Small Image Size (bytes) - size of base image of a product
    • Thumbnail - image, that is used in search or category page display cell for a particular product
    • Thumbnail Size (bytes) - size of the image above.

Additionally, there is a special condition - PHP Condition - which allows you to create your own complex conditions.

Here is the universal expression for any product attribute:

$object->getData([ATTRIBUTE_CODE]) == [ATTRIBUTE_VALUE]

object is an actual product, which currently checked by the rule. So you can virtually evaluate in the left part of this expression any combination of product attributes. But the right shall contain valid value to compare result with, otherwise condition won't work;

Actions

This section contains action, that shall be executed, when conditions on previous sections are met.

  • Customer Earning Style - strategy, which will be used for points awarding
    • Give X points to customer - customer is given with a fixed amount of points;
    • For every Y, give X points - points calculated from product's cost, which is divided into chunks. Since it is Product Rule, calculations is performed separately for each product in cart.
  • Number of Points (X) - number of points (integer number), that shall be awarded according to picked strategy. It also serves as minimal default currency amount, that can be converted to points.
  • Step (Y) - used only when For every Y, give X points strategy was selected. Contains a size of one chunk, into which product's cost is broken.
  • Maximum Distributed Points - maximum number of possibly earned points for a current rule triggering.

Notification

  • Message - this message will be displayed on product page, if the rule is valid for the current product

Cart Rules

Award points for the total amount of actual money spent on the cart. This type of rule is recommended when using tier or special prices (with taxes, dependent from shipping country, for example), which can dynamically alter the actual product sell price.

Conditions

Cart Rules has more complex condition subsystem. Although it has the same modes, as Product Rule, described above, it features three more special modes, that are selected as regular conditions, but transforms to a nested containers:

  • Product attribute combination - allows you to set the product attribute combination. Attributes list is the same, as in Product Rule. It has the following scheme: If an item is [validation mode] in the cart with [applying mode] of these conditions true:.
    • Validation mode can be either FOUND or NOT FOUND, which defines, whether checked product should exists in Cart;
    • Applying mode can be either ALL or ANY, their meaning is the same as in previous rule type: whether all conditions in this container apply, or one or more of them.
    • Additionally to product properties set, this mode provides three additional properties regarding Cart content:
      • Price in Cart - allows to check product, that match conditions, price from cart. Useful, when discounts or custom prices are used;
      • Quantity in Cart - allows to check product quantity in cart.
      • Row Total In Cart - Total cost of product, that match conditions, in current Cart. In fact, are calculated as multiply of two above properties.
  • Product subselection - allows you check the cart item attributes. It also is a container and has the following scheme If [selection mode] for a subselection of items in cart matching [applying mode] of these conditions.
    • Selection mode defines, which primary parameter is checked - product quantity (total quantity) or its row total ((total amount)). It shall be supplied with numeric value.
    • Applying mode can be either ALL or ANY, their meaning is the same as in previous rule type: whether all conditions in this container apply, or one or more of them.
    • Container can have the same conditions, as above mode.
  • Conditions combination - allows you to break rule into logical parts, each of which can be validated separately. It is extremely useful, when ANY applying mode is used for a whole rule and complex conditions required. It creates just a nested block of If *[apply mode]* of these conditions are *[validation mode]* type, as described in General section.

If no additional mode is selected, the following properties are available:

  • Subtotal - subtotal of cart, including shipping and handling fees. It also can contain discount, if Stores -> Configuration -> Sales -> Tax -> Calculation Settings -> Apply Customer Tax is set to Before discount.
  • Total Items Quantity - total items quantity in current Cart.
  • Total Weight - sum of weights of all products, contained in Cart.
  • Payment Method - payment method.

    Note

    If payment method is not selected - this condition will return false. Therefore, this condition forces earning only in checkouts, or when payment selection is available directly from Cart.
  • Shipping Method - shipping method. Note above also applies here.
  • Shipping Postcode - postal code, where products shall be sent. Note above also applies here.
  • Shipping Region - shipping region. Note above also applies here.
  • Shipping State/Province - state, where product should be delivered. Note above also applies here.
  • Shipping Country - country, where product should be delivered. Note above also applies here.

Actions

  • Customer Earning Style - strategy, which is used for points calculation.
    • Give X points to customer - customer is awarded with fixed points amount.
    • Give X points for every spent Y - points are calculated from chunks, into which Cart subtotal breaks.
    • Give X points for every Z quantity - points are calculated from total quantity of items in current Cart.
  • Number of Points (X) - quantity of points, that should be awarded for each step. It also serves as minimal points, that can be awarded.
  • Step (Y) - used only when Give X points for every spent Y strategy is selected, and defines size of one chunk, into which subtotal should be divided. It also serves as minimal currency amount, which will be awarded with points.
  • Quantity Step (Z) - used only Give X points for every Z quantity strategy is selected. If it's not empty, then items quantity will be divided into chunks of this size, and points will be calculated from them.
  • Earn Maximum - maximum number of possible earned points for the current rule.

Example

For example, you can create the following cart rules in your store:

  • Buy 3 products within one order and receive 100 points.
  • For every $1 spent, receive 1 point.
  • For every product ordered, receive 100 points.

This section also contains a special subsection Apply the rule only to cart items matching the following conditions. It is a shortcut for a condition of Product attribute combination mode (see above).

Behaviour Rules

These rules triggers only on certain customer's actions, such as writing a review or placing an order.

Conditions

This section allows to pick up Event, which corresponds with customer's action, and bind to it current rule:

  • Customer signs up in store - signing in to a store. Useful for awarding points, that should be used in the very first order.
  • Customer places order - triggered, when customer places an order, and it is completed (e. q. invoiced and shipped).
  • Customer refer a friend - customer sends an invite to a friend.
  • Customer writes a product review - customer adds a review, and it is approved by staff.
  • Customer has a birthday - this rule is executed by crontask, which starts at 00:00 of each day on every customer. If customer has birthday, rule will be executed at that time.
  • Customer is not active for a long time - should be set in days. This rule also is executed at 00:00 by crontask.
  • Customer joins the affiliate program - customer joins to affiliate program (Mirasvit_Affiliate)
  • Newsletter sign up - customer opts to receive newsletter.
  • Facebook Like - customer likes product page on Facebook.
  • Twitter Tweet - customer tweets product page on Twitter.
  • Google+ Like - customer places product pages on Google Plus.
  • Pinterest Pin - customer places a pin for a product on Pinterest.
  • Referred customer signs up in the store - referred customer (referral) signs up to the store. For more information refer to Building Referral Program section.
  • Order from a referred customer - referred customer had placed an order, and it is completed. For more information refer to Building Referral Program section.
  • Custom events - list of custom events that were created using this Custom Behavior Events

Actions

  • Number of points to give (X) - number of points that a customer receives if the rule is applied.
  • Maximum number of earned points for one customer per day - sets limit of earned points for one customer per day. Set 0 or empty to disable limit.
  • Assign customer to Group - allows to move customer to the desired Group, if rule is triggered. It is extremely useful for maintaining customer ranks program for example, or building referral program.

There's also a subsection Apply the rule only if the following conditions are met, where additional conditions can be set. Here is the list of currently supported properties:

  • Is a Referee - checks, whether customer has invited customers to a store, and they had became registered customers. It is extremely useful for building Referral Program.
  • Is a Referral - checks, whether customer is a referral (e. q. was invited by someone)
  • Group - checks, to which group belongs this particular customer.
  • Lifetime sales - calculates total of all orders, placed by current customer, and compares with value supplied.
  • Number of Orders - calculates total number of orders, placed by current customer, and compares to value supplied.
  • Is subscriber to newsletter - checks, whether customer is subscribed to newsletter.
  • Number of Reviews - calculates total number of approved reviews by current customer, and compares to value supplied.
  • Number of referred friends signups - calculates, how many of invited customers became registered customers (e. q. became referrals).
  • Number of referred friends orders - whole number of orders, placed by all referrals, invited by current customer.
  • Sum of referred friends orders - total money amount of all orders, placed by all referrals, invited by current customer.
  • Number of referred friends that ordered at least once - number of referrals, invited by current customer, which placed at least one order.

Notification

  • Message in the rewards history - a message, that will be added as description of transaction, created by this rule.
  • Message for customer notification email - a message, that will be sent to customer via email. There shall be only sensical message, not the whole template. That message will be inserted to the Balance update Email template, which can be set in Settings.

Example

For example, you can create the following behaviour rules in your store:

  • Write a review and receive 10 points
  • Refer a friend and receive 10 points when your friend makes their first order

More examples can be found at Earning Rules Examples section.