Question

The shop I'm working on sells desks. We also sell pens.

If you buy a Desk, I'd like to give you a pen for free. any further pens you add to your basket need to be paid for.

Currently, I have a Shopping Basket price rule that says the following:

CONDITIONS:
If an item is found in the cart with All of these conditions true:
Category is 3 (desk category)

Apply percent of product price discount: 100%

ACTIONS:
If All of these conditions are true:
SKU is one of pen1, pen2, pen3, etc...

I only ever want one free item in the basket though. I've tried just about every combination of conditions I can think of, but the simple fact is that Magento does not have an XOR or "run this action only once" condition.

I've even tried setting up three identical price rules, one for each pen, with "Stop further rules processing" set to "Yes". Each rule still processes in turn.

The closest I've come is adding a condition that says

If total quantity  is  1  for a subselection of items in cart matching ANY  of these conditions:
SKU is one of pen1, pen2, pen3

This condition allows one free pen in the basket, but removed the discount entirely if a second pen is added to the basket.

Can you improve on this rule?

Was it helpful?

Solution

It's not perfect, but I've got something that works for me.

I'm adding one rule per free pen. Each rule has an exclusion clause on it that says

If an item is NOT FOUND  in the cart with ANY  of these conditions true:
SKU is one of: pen1, pen2, pen3

It takes some playing with, and it's too complicated to run with any really complicated promotion, but it works for short, simple promotions. After much research I honestly think it's the best way of doing this in Magento.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top