## Changing pricing rules
This section describes how to change the calculation of the pricing fields.
Pricing rules are applied when calculating the order grand total. The main areas of price calculations in an order are: - calculating order totals
- calculating VAT
- fees
- delivery costs.
All these calculations are made in the pricing rules plugin, which consists of four sections. - Calculating order totals is implemented in the
*OrderTotalCalculator*class, which implements the*IOrderTotalCalculator*interface. - Calculating VAT is implemented in the
*VatCalculator*class, which implements the*IVatCalculator*interface. - Calculating fees is implemented in the
*FeesCalculator*class, which implments the*IFeesCalculator*interface. - Calculating delivery costs is implmented in the
*DeliveryCostCalculator*class, which implements the*IDeliveryCostCalculator*interface.
Each of above four implementations can be replaced by custom code. To replace the default implementation, make your own class and implement the intended interface from the list above, or extend the default implementation (inherit the class from the default implementation class) and copy the .dll that contains your class into the For example, to introduce your own fees, you would write your own class, which extends the namespace Litium.Studio.Sample.ECommerce.PricingRules { /// <summary> /// a basic fee calculator. /// </summary> public class BasicFeeCalculator : FeesCalculator { /// <summary> /// Calculate Fees. /// </summary> /// <param name="orderCarrier">Carrier for which fees need to be calculted</param> /// <param name="token">Security token.</param> public override void CalculateFromCarrier(OrderCarrier orderCarrier, SecurityToken token) { //TODO: implement fee calculation. } } } When you have placed the .dll file into the |

Is this page helpful?