[ic] Discount of x% on >2 items

Mark Johnson mark at endpoint.com
Sun Jan 17 04:26:58 UTC 2010


On 01/16/2010 02:24 PM, Grant 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?

The discount formula gives you the quantity in $q, either for the line
item in the case of an item-based discount, or [nitems] for
ENTIRE_ORDER. So, if I'm reading your request correctly, the following
should work by just setting it and forgetting it:

[discount ENTIRE_ORDER] $q > 2 ? $s * (100 - x)/100 : $s [/discount]

If you're looking for the test within item-based discounts:

[discount sku|ALL_ITEMS] @$Items > 2 ? $s * (100 - x)/100 : $s [/discount]

Thanks,
Mark



More information about the interchange-users mailing list