Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Discount Coupons and free items View modes: 
User avatar
Member
Member
Justin Bowers - 10/14/2013 11:26:42 AM
   
Discount Coupons and free items
I have a client who is very interested in having a coupon code to allow shoppers to get a free item. I have been able to put a 100% discount on a single item, but there does not appear to be any way to constrain the number of items that get the discount. If I add 20 of the "free" item, they are all free.

I'd really like to be able to add an item limit to the discount if possible.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/15/2013 8:36:48 AM
   
RE:Discount Coupons and free items
Hello Justin,

But from your description I'm not sure what is and what is not working in your case, so could you please describe in more details what exact behaviour are you expecting or you need?

Best regards,
Martin Danko

User avatar
Member
Member
Justin Bowers - 10/15/2013 8:41:43 AM
   
RE:Discount Coupons and free items
I want to be able for customers to add a free item to their cart. The way things are set up now, I can put a 100% discount on an item, but I cannot limit the number of those items that a customer can add to their cart.

For example. If I have a promo code that I want a customer to receive one free widget, and they go ahead and add 20 widgets to their cart, there is nothing in the system that says: 1 widget will be free, the remaining 19 will be charged for. With the current configuration, all 20 come out as free.

User avatar
Certified Developer 13
Certified Developer 13
kentico_josefd - 11/29/2013 8:37:45 AM
   
RE:Discount Coupons and free items
Hello Justin,

While there is no built in feature like this, it is achievable using simple Custom Provider, overriding method GetDiscountsInternal in ShoppingCartItemInfoProvider:


/// <summary>
/// Returns the list of all discounts which should be applied to the specified shopping cart item.
/// </summary>
/// <param name="item">Shopping cart item</param>
protected override List<IItemDiscount> GetDiscountsInternal(ShoppingCartItemInfo item)
{
List<IItemDiscount> discounts = base.GetDiscountsInternal(item);

if (discounts != null && item != null)
{
foreach (IItemDiscount discount in discounts)
{
if (discount.ItemDiscountType == DiscountTypeEnum.DiscountCoupon && discount.ItemDiscountID == "<YourDiscountCouponID>")
{
discount.ItemDiscountedUnits = 1;
}
}
}

return discounts;
}
}


This code will find out if specific coupon has been used for item in shopping cart and force it to be applied only for single item. The discount amount will then be evenly distributed across any items above the first one.

Let me know if this helps.

Regards,
Josef Dvorak