The atg.commerce.pricing.PricingTools
class is the main way in which business-layer logic interacts with the pricing engines and the other classes in the atg.commerce.pricing
package. In Core Commerce, the classes that extend the ItemPricingDroplet
class (PriceItemDroplet
and PriceEachItemDroplet
) use PricingTools
to interface with all the Core Commerce pricing engines.
When a store using Core Commerce needs a price for items, orders, shipping, or tax, PricingTools
can be consulted to return the price. In addition, PricingTools
contains translation functions that identify which currencyCode
goes with which locale.
PricingTools
includes methods that can be called to produce prices. These methods consult the configured pricing engines, which are described in detail in the Core Commerce Pricing Engines chapter.
PricingTools
also determines the pricing locale. If you are using SKU-based pricing (instead of price lists; see Using Price Lists for information), PricingTools
returns the configured defaultLocale
property. The pricing engines use this to determine the currency code. If you are using Core Commerce’s multisite feature and want to use different currency codes for different sites, you can take the following steps:
Add a pricing locale to the Site repository items.
Override the
PricingTools.getDefaultLocale
method to retrieve the currency code for the site.
Methods in PricingTools
can be used to determine whether products and SKUs can be given discounts through promotions. It also contains methods that return price servlet beans used when creating group discounts. PricingTools
also contains the MaxCouponsPerOrder
property.
See the ATG Platform API Reference for detailed information on the properties and methods of this class.