Skip to content



  1. Home
  2. Docs
  3. WooRewards
  4. Points and Rewards Systems
  5. Points formulas

Points formulas

This documentation is for the WooRewards plugin

Points formulas is a way to push your loyalty program even further. In fact, it provides you with new ways to express your creativity and reward your customers.


What is it ?

In WooRewards, there are multiple places where you can set points values. For example, performing an action grants users points. In addition, redeeming a reward costs points.

With points formulas, instead of setting a fix points value, you have the possibility to set a formula. As a result, the points value will vary, depending on the situation.

The possibilities are endless. However, it will require some learning to get the best of it. Let’s begin now with the basics.


WooRewards supports basic operators. Therefore, you’ll find here the following possibilities

  • + : The addition operator
  • – : The subtraction operator
  • * : The multiplication operator
  • / : The division operator
  • > : The greater operator (The result of this operator is always 1 or 0)
  • < : The lower operator (The result of this operator is always 1 or 0)

This is pretty standard. Let’s complete it with some basic examples of formulas you can use.

  • = 2 + 2 : Simple addition. The result is 4
  • = (2 + 2) * 3 : An addition and a multiplication with priority brackets. The result is 12.
  • = 2 + (2 *3) : Same but with a different priority. The result is 8.

With these few examples, you can see that it’s fairly easy to set formulas. And useless too at this point. This is why, in the following section, we’ll see how to add some useful values.


In addition to operators, there are a couple of functions you can use in your formulas. Here are the available functions :

  • floor@ : Rounds the value to the nearest inferior integer
  • ceil@ : Rounds the value to the nearest superior integer
  • round@ : Rounds the value to the nearest integer (rounds up if .5 or above)
  • date@ value, ‘format’ : value is a timestamp, and format is the date format to consider (Example: date@ {time], ‘d’)
  • min@ : Returns the minimal value between all values provided
  • max@ : Returns the maximal value between all values provided
  • equal@ : returns 0 if the arguments are not equal and 1 if they are
  • not@ : returns 1 if the argument’s value is 0
  • abs@ : returns the absolute value of the argument

Variable values

Now, let’s get to the good stuff. To set formulas that will help you set up the perfect loyalty program, you need some variables. Here are the possibilities :

  • time : returns the current timestamp.
  • user_integer:meta_key : returns a user meta as an integer value.
  • user_float:meta_key : returns a user meta as a float value.
  • user_timestamp:meta_key : returns a user meta as a timestamp (from int value or textual date).
  • points:stack_id : returns a points amount from the current user’s points reserve.
  • badge:xx : returns 1 or 0 if the current user owns the given badge (replace xx by the badge id).
  • role:xx : returns 1 or 0 if the current user owns the given role (replace xx by a slug).

This immediately looks a lot more complicated. But don’t worry, it’ll become crystal clear (almost) with a few examples.

Finally, here are some other variable values that only work for methods to earn points tied to an order. For example, you can use it for the points methods “Spend Money”, “Place an order”, “Buy specific products” …

  • order:total : The order total
  • order:total_vat_exc : The order total, without VAT
  • order:total_vat_inc: The order total, including VAT
  • order:subtotal : The order subtotal, before shipping and VAT
  • order:discount : The discounts total applied to the order
  • order:shipping : The shipping amount
  • order:onsale : The sum of all on-sale product prices in the order
  • order:regular : The sum of all not on-sale product prices in the order

Formulas examples

Now that we have a list of all possible values, let’s try them with some examples. Of course, these are only some of the possible uses of points formulas. The only limit is your creativity. Don’t hesitate to share your formulas with us !

Earn more points in higher levels

In this example, we’ll consider that you have a leveling system. The first level is at 1 point, the second level at 200 points and the third level at 500 points. At level 1, customers earn 1 point for each $1 spent. At level 2 they will earn 2 points for each $1 spent and, finally, at level 3, they will earn 3 points for each $1 spent.

Your leveling points and rewards system uses the leveling points reserve. Here is the formula to use :

=1 + ({points:leveling} > 199) + ({points:leveling} > 499)

Points equal to the customer’s age

If you want to offer a birthday gift to your customers that depend on their age, this formula is for you.

=round@ (({time} - {user_timestamp:billing_birth_date}) / (60*60*24*365))

More points depending on the user role

If you have a leveling system that gives specific user roles to your customers, you can also change how many points they earn depending on their role. In this example, we’ll say that Bronze members earn 10 points, Silver members earn 20 points and Gold members earn 50 points. Here’s the points formula :

=({role:bronze} * 10) + ({role:silver} * 20) + ({role:gold} * 30)

Give more points on a user’s birthday

If you want to give more points to users on their birthday, use this formula. Here, customers will earn 1 point when it’s not their birthday and 2 points when it’s their birthday :

= 1 + (equal@ (date@ {time}, 'd'), (date@ {user_timestamp:billing_birth_date}, 'd')) * (equal@ (date@ {time}, 'm'), (date@ {user_timestamp:billing_birth_date}, 'm'))

Some more tips

Points formulas also work on the “Generate Points” reward. You can use that to expand even further your loyalty program.

Don’t hesitate to experiment or ask us for help if you’re stuck with a formula.

Scroll To Top