I was able to use the IShoppingCartCalculator
. In there, I retrieve the current shopping cart and save the tariff information as custom data.
public class TariffChargeShoppingCartCalculator : IShoppingCartCalculator
{
/// <summary>
/// Runs shopping cart calculation based on specified calculation data.
/// </summary>
public void Calculate(CalculatorData calculationData)
{
decimal extraCharge = 0;
// ...
var shoppingService = Service.Resolve<IShoppingService>();
var cart = shoppingService.GetCurrentShoppingCart();
cart.ShoppingCartCustomData["Section301Tariffs"] = extraCharge;
calculationData.Result.Total += extraCharge;
calculationData.Result.GrandTotal += extraCharge;
}
}
Hope this helps others. It would still be good to know, if there's a better solution.