Kentico eCommerce discount to product options

Dcode warner asked on March 9, 2017 23:15

Is there any way I can apply a discount to product options. The discount works well with items with unit prices but not with products with options. I want 25% off any other. Even if it's at check out using a product code.

Recent Answers


Trevor Fayas answered on March 10, 2017 00:27 (last edited on March 10, 2017 00:46)

A Catalog Discount can apply a discount across the entire Product line, and may be what you are looking for.

In the Catalog Discount, set your Discount of 25% you can edit the "Apply To" and then use the macro editor to find the right ones.

Such as

SKU.IsProductOption && SKU.SKUOptionCategory.CategoryName = "TheSkuCategoryName"

That should allow you to apply rules to those Product Options.

Does that help? The only downside is it isn't a "Coupon" based discount. If you need to do the coupon approach, make a product coupon, apply it to all the products that use this product option (or just apply to all), and write a custom override, see below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Override
/// </summary>
public class CustomCouponInfoProvider : CMS.Ecommerce.DiscountCouponInfoProvider
{
    protected override double CalculateUnitDiscountInternal(CMS.Ecommerce.ShoppingCartItemInfo item, CMS.Ecommerce.DiscountCouponInfo discount, double basePrice = 0)
    {
        if (discount.DiscountCouponCode == "DiscountOnProductOption" && item.IsProductOption && item.SKU.SKUOptionCategory.CategoryName == "TheOptionCategory")
        {
            // applies
            return (discount.DiscountCouponIsFlatValue ? item.CartItemPrice - discount.DiscountCouponValue : item.CartItemPrice*(1-discount.DiscountCouponValue));
        } else {
            // Doesn't apply
            return item.CartItemPrice;
        }
    }
}
0 votesVote for this answer Mark as a Correct answer

Dcode warner answered on March 10, 2017 00:43

Cool Where can I find "Catalog Discount "

And the the code or section to implement the : SKU.IsProductOption && SKU.SKUOptionCategory.CategoryName = "TheSkuCategoryName"

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 10, 2017 00:47

I updated my answer to be a little more thorough, but otherwise the Catalog DIscount is it's own module (Kentico icon -> Catalog Discount)

https://docs.kentico.com/k10/e-commerce-features/managing-your-store/discounts/working-with-catalog-discounts

0 votesVote for this answer Mark as a Correct answer

Dcode warner answered on March 10, 2017 00:49

Im using Kentico 7. Do this still apply?

0 votesVote for this answer Mark as a Correct answer

Dcode warner answered on March 10, 2017 01:03

Or a work around to get the same results

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 10, 2017 01:17

That...no clue, Version 7 is VERY outdated, and ecommerce came a long way in versions 8.2 onwards. I would be surprised if you can pull it off in 7. I would look to upgrade to at least 9, if not 10.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.