This section explains the Litium pricing model. It is divided into pricing and order grand total calculation.
Pricing and price lists
Price lists are used to store all prices in Litium in both B2C and B2B scenarios. While consumers usually get prices from the same price list, best practice for B2B is to connect companies in Litium (organizations) to price lists. A price list can be connected to one or many organizations. The typical B2B scenario is that the customer of the merchant has negotiated a reduced price for certain products. For the prices to be shown correctly in this scenario, the cusomer needs to be logged in. The reduced price is not shown as a discount wich is usually shown with the ordinary price beside as comparison.
The price shown to the user may also be a discounted price. Note that there are other discounts as well, which do not affect the unit price but the overall order grand total such as "free shipping".
Litium will return the lowest price from the price lists that are valid for a customer. It's possible to set priorities on price lists, which can result in a a higher price returned:
- a) Priority 10: price 100
- b) Priority 1: price 1000
the price 1000)from the second price list will be returned because of the higher priority.
Order grand total calculation
When the user clicks the Buy button on the site, the product is added to the shopping cart, and an overall price of the order is calculated. The final order price calculated may include discounts from campaigns, as well as additional costs such as VAT and shipping costs.
Example
Get list price:
using System;
using System.Linq;
using Litium.Products.PriceCalculator;
namespace Litium.Samples.Products
{
public class Price
{
public decimal GetListPrice(IPriceCalculator priceCalculator, Guid variantSystemId, Guid currencySystemId, Guid userId, Guid channelSystemId, Guid countrySystemId)
{
var priceCalculatorArgs = new PriceCalculatorArgs
{
CurrencySystemId = currencySystemId,
DateTimeUtc = DateTime.UtcNow,
UserSystemId = userId,
ChannelSystemId = channelSystemId,
CountrySystemId = countrySystemId
};
var calculatorItemArgs = new PriceCalculatorItemArgs
{
VariantSystemId = variantSystemId,
Quantity = 1
};
var listPrice = priceCalculator.GetListPrices(priceCalculatorArgs, calculatorItemArgs);
return listPrice.FirstOrDefault(p => p.Key == variantSystemId).Value.ListPrice;
}
}
}
Changing price calculator
You can fetch list prices from an ERP system in "real-time". If this method is implemented, the ERP system will be queried for each price fetch. Note that performance can be affected if you use this method.
To change the price calculator to fetch prices from other systems, override Litium.Products.PriceCalculator.IPriceCalculator. The IPriceCalculator needs implementation to get the prices for variants and be able to return the pricelists that the user can fetch prices from. If the solution always fetches the prices from an ERP system without any price lists in Litium the GetPriceLists method could return an empty collection.
Minimum quantity
For each price it is possible to set minimum quantity, this is used when the variant has tier prices. The first price in the price list for each variant should always have 0 (zero) as the minimum quantity. If having a price for a variant that does not have a minimum quantity of 0 (zero) this will reflect for the campaign engine that the variant has tier prices and product campaigns is not applied.