Thanks for the sample - I used this code and modified it so the actual calculation is in a public class/method to calculate costs based on Payment Name / Fee from a Custom Table. I then created another webpart to display the fee as a separate line in the Checkout Order Summary (uses that public method above). The Fee now displays, but the cart total is unchanged. https://gyazo.com/ca10eff03d5069a1cd9b38c04a9fc1bc
How do I 'enable' the new CustomShoppingCartInfoProvider? I understand how to do this with a new CustomShippingProvider : ICarrierProvider because it is a new carrier which is configurable within the CMS. The Total is using the Shopping Cart Totals webpart.
Edit - This https://docs.kentico.com/display/K9/Registering+providers+using+assembly+attributes shows that it should 'just work' with the assembly decorations. I have a breakpoint on the new provider and it never fires.
Edit2- Not the most elegant code, but it's within App_Code as the bottom static class method fires for the webpart display.
public class ShoppingCartFee : ShoppingCartInfoProvider
protected override double CalculateTotalPriceInternal(ShoppingCartInfo cart)
var totalPrice = base.CalculateTotalPriceInternal(cart);
totalPrice += CalculateShoppingCartFee.Calculate(cart.PaymentOption.PaymentOptionDisplayName);
public static class CalculateShoppingCartFee
public static double Calculate(string PaymentName)
double totalFee = 0;
CMS.DataEngine.ObjectQuery<CustomTableItem> cti = CustomTableItemProvider.GetItems("tcle.PaymentTypeFee");
var fees = from f in cti.AsEnumerable()
paymentName = f.GetValue<string>("PaymentName", ""),
fee = Convert.ToDouble(f.GetValue<float>("Fee", 0f))
foreach (var f in fees)
if (PaymentName.ToLower() == f.paymentName.ToLower())
totalFee = f.fee;
//snippet of webpart using similar code
var paymentName = ECommerceContext.CurrentShoppingCart.PaymentOption.PaymentOptionDisplayName;
double fee = CalculateShoppingCartFee.Calculate(paymentName);
Edit3 - The typeof in the decorator was changed to my class definition, not the overridden class. it now works as intended.