# Loyalty System on Product Quantity Basis

Have asked the local pub who use samba I setup for them to give me a challenge LOL
He wants to implement a loyalty card system for locals after the summer peak dies down.
There are many loyaly based tutorials but they seem to generally be on a transaction value basis but he wants to do 10th drink free.
They were originally looking just to use business card type vouchers with a stamp as pints are purchased but think given that it is possibly why not utilise the power of samba.
Also most locals have a customer entity on the till which they use for bar tabs using these entities makes sense rather than use coupon/card with separate id. However an msr to automaticly assign entity to that customer might work well.

My thought is to add fields to the entity type for drink count and work out an action to accumulate ‘points’ as such for each drink they buy and along with a rule which will check this entity field each time order added to entity ticket to make the 10th drink free.
To make it a little more complicated he obviously doesn’t want someone to order all half pints and then have a free pint or all small wines and get a free large wine. (although I have a thought to account for wine and beer sizes by allocating different points based on size in such a way that sizes are worked in factors of a bottle/pint which in theory would mean a combination of wine sizes could be used - will need to work the maths on that but sure it will work but simpler to explain the thought would be half pint worth 0.5 points, pint 1 point, 10 pints = free pint with 10 points, half worth 0.5 x 10 = 5 points for free half which would also mean 20 halfs would = free pint, or 5 pints = free half)

Anyway on from this to keep it a little easier he is only offering deal on similar drinks - ie only wine counts towards free wine.

So I am thinking 4 fields - draft, spirits, bottles and wine points.

Question is does anyone have a suggestion for a formula to update an entity field in a cumulative basis? Is this even possible?

Samba formulas are still area I struggle to get my head round but given this I should be able to work out the rest as should be relatively basic set of rules/actions with some creative constraints.

Will share how I get on for anyone interested in a similar style of offer.

1 Like

This tut might be a good start.

2 Likes