Hi,
The most suitable way to go if you need to implement surcharge requirement is to create custom evaluate shopping cart method using custom ecommerce provider and customize
CustomShoppingCartInfoProvider.cs file, its
EvaluateShoppingCartContent(object shoppingCart) method.
You will need to create a temporary dummy product which will not be enabled and its price will be totalPrice * 1,025 (if surcharge is 2.5%). The totalPrice is a property of shopping cart object. Then you will need to add this product to the shopping cart and EvaluateShoppingCart again. On the beginning you need to check if the dummy product is not already included in the cart (if user clicks on Next or Prev button while creating of his shopping cart). The method could look like:
/// <summary>
/// Evaluates shopping cart content - calculates all taxes, discounts and subtotals.
/// </summary>
/// <param name="shoppingCart">Shopping cart object with all neccessary data for calculation.</param>
public void EvaluateShoppingCartContent(object shoppingCart)
{
// TODO: Remove dummy product if it is in a shopping cart
ShoppingCartInfoProvider.EvaluateShoppingCartContent((CMS.Ecommerce.ShoppingCartInfo)shoppingCart);
// TODO: Count price of dummy product
// TODO: Set price of dummy product
// TODO: Add dummy product to the shopping cart again
// Evaluate again
ShoppingCartInfoProvider.EvaluateShoppingCartContent((CMS.Ecommerce.ShoppingCartInfo)shoppingCart);
}
Best regards,
Ivana Tomanickova