# Multi Buy Set up Constraints

I am trying to configure a multi buy setup.
I have it working where item 1 is added and when item 2 is added the customer receives a discount of €20.

This issue is when Item 1 is added again the discount of €20 is added again. When I add item 2 again another discount is applied.

There should only be a discount applied for every pair of items added ie. a total of €40 discount.

Anyone have any ideas of how to accomplish this?

Your going to need to work out a constraint to compair them rather than just greater than 0, thats why its adding with every one once there is one of each.

A calculation which sets discount to 20 x the number of pairs…
Am struggling to think of the calculation right now though…

You might need two actions…

1st
with action constraint;
count promo 1 > count promo 2
`[=TN('{TICKET QUANTITY SUM:Promo Test}')] > [=TN('{TICKET QUANTITY SUM:Promo Test 2}')]`
with calculation for discount as;
20 x count promo 2
`[=F(TN({TICKET QUANTITY SUM:Promo Test 2})*20)]`

2nd
with action constraint;
count promo 2 > count promo 1
`[=TN('{TICKET QUANTITY SUM:Promo Test 2}')] > [=TN('{TICKET QUANTITY SUM:Promo Test}')]`
with calculation for discount as;
20 x count promo 1
`[=F(TN({TICKET QUANTITY SUM:Promo Test})*20)]`

1 Like

I think solved it.
{TICKET QUANTITY SUM:Promo Test} Equals {TICKET QUANTITY SUM:Promo Test 2}

Yes but this will only work as planned if you ring in 1, 2, 1, 2 and so on in turn.
If you work to calculate like above it will work in any way,
1, 1, 1, 2, 2 would discount 40 your way would ignore as at no point is 1 count equal to 2
Then if you added a third 2 it would discount once.
Using a function/calculation would mean it would refresh each time order added.
Your way if you canceled one it wouldnt remove the discount but this way the calculation would account for the new counts. I get what your saying. I’m going to have to rethink this

Have a play with the constraints and calculations I added above.
Am not at PC to test so may not work first time but should give you a head start.
Add some ask questions with the same constraints and the expressions as the questions so you can see the numbers being returned to check what’s wrong if not working or not acting as expected.

Thank you @JTRTech I have it working. I’m going to play around with custom product tags to try make this variable.

A promo setup like that with flexiblility is on my lists as something to do a good setup and tutorial for.
Not sure if you can count item tags, if not translate the tags to states on order added, states are very handy for things like that.