[ic] Discount of x% on >2 items

Peter peter at pajamian.dhs.org
Sun Jan 17 01:17:34 UTC 2010

On 17/01/10 08:46, Paul Jordan wrote:
>> I'd like to apply a discount whereby x% is taken off of the total
>> order price if there are 3 or more items in the cart.  Should I write
>> some code to check the number of items in the cart at each page load
>> and apply or remove the [discount] based on that, or does IC have some
>> built-in stuff that will help there?
> That is what I did. IIRC Mike helped me a bit. I believe his advice was
> to remove the discount on every page, and attempt to reapply it on every
> page. I guess it's more defensive - assume they don't get it, and just
> check if they do. This was about 2 years ago and I don't think there was
> anything to accommodate my needs. We do a buy 4 get one free - perpetual
> (I.e., buy 8 get 2 free...), and has the ability to consider a second
> (additional) $/% discount.
> Whether or not I used the discount tag I don't remember, but I can say
> your intentions work, and are at least proper enough for MH to give it a
> nod. Oh, you know I didn't use the discount tag, I actually inserted an
> item with a price as the discount amount. I don't remember why I needed
> to do it that way - but if you do it that way, you need to account for
> that extra item. Perhaps it was because I have two discounts that can
> work in unison.

Another option is to use CommonAdjust.  You can put a usertag in as a
CommonAdjust atom and then code the usertag to check how many items are
in the cart and return a discount amount (ie it could return "-10%").
You would actually be taking the % off of each individual item but the
result would be the same.  This also allows you to control whether you
want to take the % off of options or not, etc. according to the
placement of the discount in the CommonAdjust line.

for more info.


More information about the interchange-users mailing list