Calculates prices for products, shipping and checkout in the e-commerce store, applying pricing rules, promotions and store-level configuration. Reached from Java code via the "price.manager" Spring bean, this is the single place that turns a product, SKU and quantity into an itemised price with tax, discounts and promotional adjustments applied. It also manages the store's pricing rules, pricing configuration, checkout rule types and shipping providers, and persists changes to them.
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| checkoutRuleTypes | List<CheckoutRuleType> | Lists the checkout rule types registered by every active e-commerce application on the current root folder, such as custom shipping or payment options a checkout rule can be built around. |
Methods
getRules(Website website) · getRules(ECommerceStore store) · itemisedUnitPrice(BaseEntity purchaser, ProductInEComStore productInStore, ProductSku sku, Cart cart) · itemisedUnitPrice(BaseEntity purchaser, Product product, ECommerceStore store, Cart cart) · findLowestPriceSkuForProduct(Product product) · itemisedPrice(ProductOrder po, Cart cart) · itemisedPrice(BaseEntity purchaser, BigDecimal quantity, ISale sale) · itemisedPrice(BaseEntity purchaser, ProductInEComStore productInStore, ProductSku sku, BigDecimal quantity, ISale sale) · itemisedPrice(BaseEntity purchaser, ProductInEComStore productInStore, ProductSku sku, BigDecimal unitCost, BigDecimal quantity, ISale sale) · allShippingProviders(Website website) · allShippingProviders(ECommerceStore store) · availableShippingProvider(Cart cart, String id) · availableShippingProvider(Cart cart, ECommerceStore store, String id) · availableShippingProviders(Cart cart) · availableShippingProviders(Cart cart, ECommerceStore store) · calcFreightCost(ShippingProvider provider, Cart cart) · saveRules(String storeName, List<PricingRule> list, Website website) · createPricingConfiguration(String currencyCode, List<String> pointsBucketNames) · savePricingConfig(String storeName, PricingConfiguration config, Website website) · saveCheckoutRules(String storeName, CheckoutRules checkoutRules, Website website) · getCheckoutRuleTypes() · checkoutRuleType(String id)
getRules(Website website)
Returns: PricingRulesSet
Looks up the pricing rules for the first e-commerce store found on the given website.
| Parameter | Description |
|---|---|
website | the website whose first e-commerce store's pricing rules are returned |
getRules(ECommerceStore store)
Returns: PricingRulesSet
Looks up the pricing rules for the given e-commerce store: its pricing rule set, shipping providers, tax providers, checkout rules and other store-level pricing configuration.
| Parameter | Description |
|---|---|
store | the e-commerce store whose pricing rules are returned |
itemisedUnitPrice(BaseEntity purchaser, ProductInEComStore productInStore, ProductSku sku, Cart cart)
Returns: ItemisedPrice
Calculates the itemised price of one unit of a SKU for a purchaser, with pricing rules and promotions applied but no order quantity or total order value taken into account.
| Parameter | Description |
|---|---|
purchaser | the profile or organisation the price is calculated for, used by pricing rules |
productInStore | the product, as listed in an e-commerce store, to price |
sku | the specific SKU to price |
cart | the cart the price is being calculated for, used to look up active promotions, or null if there is no cart |
itemisedUnitPrice(BaseEntity purchaser, Product product, ECommerceStore store, Cart cart)
Returns: ItemisedPrice
Calculates the itemised unit price of a product's lowest-cost SKU in the given store, for a purchaser. Looks up the product's listing in the store and its lowest-price SKU, then delegates to the itemised unit price overload that takes a productInStore and sku directly.
| Parameter | Description |
|---|---|
purchaser | the profile or organisation the price is calculated for, used by pricing rules |
product | the product to price |
store | the e-commerce store the product is priced in |
cart | the cart the price is being calculated for, used to look up active promotions, or null if there is no cart |
findLowestPriceSkuForProduct(Product product)
Returns: ProductSku
Finds the cheapest SKU of a product, by base cost.
| Parameter | Description |
|---|---|
product | the product whose SKUs are searched, may be null |
itemisedPrice(ProductOrder po, Cart cart)
Returns: ItemisedPrice
Calculates the itemised price of a product order line, re-running pricing rules against the order's current quantity rather than reusing any previously overridden unit cost stored on the order. Returns null for service order lines that have no product.
| Parameter | Description |
|---|---|
po | the product order line to price |
cart | the cart the order line belongs to, used to look up active promotions |
itemisedPrice(BaseEntity purchaser, BigDecimal quantity, ISale sale)
Returns: ItemisedPrice
Returns an itemised price with only the quantity populated; the purchaser and sale are accepted but not used, so no pricing rules are applied and the list price, tax and promotional cost are left null. Prefer the itemisedPrice overload that takes a productInStore and sku for a fully computed itemised price.
| Parameter | Description |
|---|---|
purchaser | accepted but not used by this overload |
quantity | the quantity to record on the returned itemised price |
sale | accepted but not used by this overload |
itemisedPrice(BaseEntity purchaser, ProductInEComStore productInStore, ProductSku sku, BigDecimal quantity, ISale sale)
Returns: ItemisedPrice
Calculates the itemised price of a quantity of a SKU for a purchaser, with pricing rules and promotions applied. The unit cost is taken from the SKU rather than overridden.
| Parameter | Description |
|---|---|
purchaser | the profile or organisation the price is calculated for, used by pricing rules |
productInStore | the product, as listed in an e-commerce store, to price |
sku | the specific SKU to price |
quantity | the quantity being priced |
sale | the sale the price belongs to, such as a Cart, Invoice or Quote, used to look up the total order value and active promotions, or null |
itemisedPrice(BaseEntity purchaser, ProductInEComStore productInStore, ProductSku sku, BigDecimal unitCost, BigDecimal quantity, ISale sale)
Returns: ItemisedPrice
Calculates the itemised price of a quantity of a SKU for a purchaser: applies pricing rules and active promotions to work out the adjusted ex-tax price, then calculates tax and the tax rate. If the product is not listed in an e-commerce store, pricing rules cannot be applied and the price is based on the unit cost or SKU base cost alone.
| Parameter | Description |
|---|---|
purchaser | the profile or organisation the price is calculated for, used by pricing rules |
productInStore | the product, as listed in an e-commerce store, to price, or null if the product is not listed in a store |
sku | the specific SKU to price, or null |
unitCost | the ex-tax unit cost to use instead of the SKU's cost, or null to use the SKU or productInStore cost |
quantity | the quantity being priced |
sale | the sale the price belongs to, such as a Cart, Invoice or Quote, used to look up the total order value and active promotions, or null |
allShippingProviders(Website website)
Returns: List<ShippingProvider>
Looks up all shipping providers configured for the first e-commerce store found on the given website, regardless of whether they are currently available for a cart.
| Parameter | Description |
|---|---|
website | the website whose first e-commerce store's shipping providers are returned |
allShippingProviders(ECommerceStore store)
Returns: List<ShippingProvider>
Looks up all shipping providers configured for an e-commerce store, regardless of whether they are currently available for a cart.
| Parameter | Description |
|---|---|
store | the e-commerce store whose shipping providers are returned |
availableShippingProvider(Cart cart, String id)
Returns: ShippingProvider
Finds an available shipping provider for a cart by id, looking up the store from the cart itself.
| Parameter | Description |
|---|---|
cart | the cart the shipping provider must be available for |
id | the id of the shipping provider to find |
availableShippingProvider(Cart cart, ECommerceStore store, String id)
Returns: ShippingProvider
Finds a shipping provider that is available for a cart, by id.
| Parameter | Description |
|---|---|
cart | the cart the shipping provider must be available for |
store | the e-commerce store to look up shipping providers in |
id | the id of the shipping provider to find |
availableShippingProviders(Cart cart)
Returns: List<ShippingProvider>
Finds the shipping providers that are available for a cart, looking up the store from the cart itself.
| Parameter | Description |
|---|---|
cart | the cart to find available shipping providers for |
availableShippingProviders(Cart cart, ECommerceStore store)
Returns: List<ShippingProvider>
Finds the shipping providers configured for a store that are currently available for a cart, by filtering all configured providers down to those whose availability rules the cart satisfies.
| Parameter | Description |
|---|---|
cart | the cart to check shipping provider availability against |
store | the e-commerce store to look up shipping providers in |
calcFreightCost(ShippingProvider provider, Cart cart)
Returns: BigDecimal
Calculates the freight cost of a cart using the given shipping provider.
| Parameter | Description |
|---|---|
provider | the shipping provider to calculate freight with, may be null |
cart | the cart to calculate freight for |
saveRules(String storeName, List<PricingRule> list, Website website)
Returns: void
Saves the pricing rules for an e-commerce store, replacing any rules previously saved for that store.
| Parameter | Description |
|---|---|
storeName | the name of the e-commerce store the rules apply to |
list | the pricing rules to save |
website | the website the store belongs to |
createPricingConfiguration(String currencyCode, List<String> pointsBucketNames)
Returns: PricingConfiguration
Builds a new pricing configuration with default values: no shipping or tax providers, the given currency and points buckets, reason code "P" (purchase), inventory control disabled, and empty SEO and data series fields.
| Parameter | Description |
|---|---|
currencyCode | the currency code for the new pricing configuration |
pointsBucketNames | the points bucket names for the new pricing configuration |
savePricingConfig(String storeName, PricingConfiguration config, Website website)
Returns: void
Saves the pricing configuration for an e-commerce store, replacing any configuration previously saved for that store.
| Parameter | Description |
|---|---|
storeName | the name of the e-commerce store the configuration applies to |
config | the pricing configuration to save |
website | the website the store belongs to |
saveCheckoutRules(String storeName, CheckoutRules checkoutRules, Website website)
Returns: void
Saves the checkout rules for an e-commerce store, replacing any checkout rules previously saved for that store.
| Parameter | Description |
|---|---|
storeName | the name of the e-commerce store the rules apply to |
checkoutRules | the checkout rules to save |
website | the website the store belongs to |
getCheckoutRuleTypes()
Returns: List<CheckoutRuleType>
Lists the checkout rule types registered by every active e-commerce application on the current root folder, such as custom shipping or payment options a checkout rule can be built around.
checkoutRuleType(String id)
Returns: CheckoutRuleType
Finds a registered checkout rule type by id.
| Parameter | Description |
|---|---|
id | the id of the checkout rule type to find |