Shipping Calculator
You can create multiple shipping calculators by implementing IShippingCalculator. Once a calculator has been created, it can be configured in the Umbraco back office.
Example
Rescope.Commerce.Core ships with a fixed rate calculator by default. The source for this simple calculator is:
[CalculatorName("Fixed Rate")]
public class FixedShippingCalculator : IShippingCalculator
{
public FixedShippingCalculator() { }
// SettingOptionAttribute allows the user to set this value in Umbraco
[SettingOption]
public decimal FixedRate { get; set; }
public void Calculate(ShippingCalculation calculation)
{
foreach (var line in calculation.LineItems)
{
line.UnitShippingPrice = 0;
line.TotalShippingPrice = 0;
}
calculation.TotalShippingPrice = FixedRate;
calculation.ExpectedDeliveryTime = null;
}
}