Custom Pricing for Bundled Products with Insite Commerce

Bundled products allow the client to sell a group of products to a customer. Insite out of the box with the Generic Pricing Plug In will include the child products price for the bundled price. I am going to show how to customize Insite to allow the pricing to only include the bundled product price item and not include the child items.

In this example, we will be creating a bundled security starter kit. This bundle will include three security cameras, five motion sensors and one wireless hub. The security cameras will cost $199 each.

As a side note, as you are doing this don't forget to save your work throughout the process!

In order to customize Insite we are going to extend the Generic Price Service that comes with the Insite SDK plugs.

Next, we need to override the ConfigurePrice function and the PricingServiceGeneric so it will not include the child products.

To create the base Pricing class and extend the PricingServiceGeneric do as follows:

using InSite.Model.Interfaces;
using InSite.Model.Services.PricingService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace InSiteCommerce.Web.Pricing
   public class PricingServiceCustom : PricingServiceGeneric
      public PricingServiceCustom(IUnitOfWork unitOfWork) : base(unitOfWork) 
      { ; }
Next, we will need to override the ConfigurePrice function in the PricingServiceCustom class. This function takes four properties: price, configDataSet, isFixedConfiguration and currenyCode.

Price is the current calculated amount for the product in the Insite Price Calculation logic. This function should return a price with any additional changes for the amount based on the calculation. The configDataSet is the specific configuration for the product. The isFixedConfiguration value is TRUE if the user can change the configuration. The value is FALSE if the user is not able to change the configuration. The currency code is the domination to perform the price calculation.

In the next example, it will show when the price configuration calculation is called. If the bundled product has a price (greater than zero) we are not going to include the configuration calculation in the price total. If there is no product configuration calculation the function will return the property price. If the product price is zero then we include the product configuration price. To include the product configuration price call the base ConfigurePrice function from the PricingServiceGeneric class. The value returned from the base function will be returned with no additional calculations.

protected override decimal ConfigurePrice(
   decimal price, 
   System.Data.DataSet configDataSet,
   bool isFixedConfiguration,
   string currencyCode)
   if (price >= 0) {
      return price;

   return base.ConfigurePrice(price, configDataSet, 
      isFixedConfiguration, currencyCode);
Once you have completed this you have designed your own custom pricing for bundled products with Insite Commerce.

Categories: Commerce
Tags: Insite;