Try our conversational search powered by Generative AI!

ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Hiding promotion types

This topic explains how to determine which promotion types appear on the Edit Discount view in Episerver Commerce. To do this, use the PromotionTypeHandler class.

Note: In the user interface, promotions are called "discounts."

How it works

The PromotionTypeHandler class provides methods to hide promotions on the Edit Discount view. Use it to prevent marketers from creating new promotion of those types.

  • DisablePromotions. To disable specific promotion types. These promotions do not appear in the Edit Discount view.
  • EnablePromotions. To enable specific promotion types.
  • DisableBuiltinPromotions. To disable all built-in promotion types. If this is set, only custom promotions are enabled in the UI.
  • GetAllPromotionTypes. Gets all promotion types in your site.


Disable the BuyQuantityGetFreeItems promotion.

var promotionTypeHandler = ServiceLocator.Current.GetInstance<PromotionTypeHandler>();
promotionTypeHandler.DisablePromotions(new[] { typeof(BuyQuantityGetFreeItems) });

Re-enable that promotion.

promotionTypeHandler.EnablePromotions(new[] { typeof(BuyQuantityGetFreeItems) });

Disable all built-in promotion types when a site is initialized.

namespace EPiServer.Commerce.Sample.Business.Initialization
    public class InitializationModule : IConfigurableModule
        public void Initialize(InitializationEngine context)

public void Uninitialize(InitializationEngine context) { } public void ConfigureContainer(ServiceConfigurationContext context) { } private void DisablePromotionTypes(InitializationEngine context) { var promotionTypeHandler = context.Locate.Advanced.GetInstance<PromotionTypeHandler>();
// To disable all built-in promotion types promotionTypeHandler.DisableBuiltinPromotions(); } } }
Do you find this information helpful? Please log in to provide feedback.

Last updated: Aug 08, 2016

Recommended reading