Oracle ATG Web Commerce pricing services are based on two complementary elements: pricing engines and pricing calculators. These components work together to determine prices for orders, sales tax, and shipping.
Pricing engines are responsible for these tasks:
- Retrieving any promotions that are available to site visitors 
- Determining which pricing calculators generate prices 
- Invoking the calculators in the correct order 
Pricing calculators are responsible for the following:
- Looking up the price. 
- Using information they receive from the pricing engines, promotions, and the qualifier service to determine prices. 
The following overview describes the way Commerce calculates prices.
Note: If your promotions were generated using Oracle ATG Web Commerce 9.1 or earlier versions, see the documentation for that version; the pricing process treats promotions differently depending on the version of Commerce used to create them.
Before pricing happens, the following steps take place:
- On a scheduled basis, the pricing engines load global promotions (those defined as applying automatically to all customers). An engine builds its list by using its - globalPromotionsQueryproperty to query the Promotions repository, searching for any promotion where the Automatically Give to All Customers (- global) property is set to- true. Each engine loads the global promotions that are specific to that pricing engine; for example, the- ItemPricingEngineloads the global Item Discount promotions.
- At the start of the customer session, a - PricingModelHolderinstance is created.- PricingModelHoldercalls each pricing engine’s- getPricingModels()method.
- The pricing engine - getPricingModels()method gets any promotions listed in the- activePromotionsproperty of the current customer’s profile and merges them with the global promotions list it previously created. The pricing engine can also veto promotions from being returned to the- PricingModelHolderat this point.
- PricingModelHolderperiodically updates both the global and active promotions.
The result is that PricingModelHolder has a merged list of global and active promotions for each pricing engine. When the customer performs an action that prompts a pricing operation, such as adding an item to their cart, the following steps are performed:
- The business layer logic (such as a - PriceItemservlet bean in a page) invokes a pricing engine (see The Base Pricing Engine).
- The pricing operation invokes - PricingToolswhich then gets the- PricingModelHolderfor that customer.
- PricingToolsgets the promotions from the- PricingModelHolderand calls the pricing engine’s- priceItemsmethod, passing in the promotions as a list.
- The pricing engine applies its configured precalculators in the order in which they appear in its - preCalculatorsproperty. A precalculator modifies a price without using any associated promotions. For example, a site could use a list price precalculator or an order subtotal precalculator to establish a base price to which subsequent calculators then apply a discount.- Each type of engine calls its corresponding type of precalculator – for example, the - OrderPricingEngineImplcalls- OrderPricingCalculatorsand the- TaxPricingEngineImplcalls- TaxPricingCalculators.
- The pricing engine then takes the promotions list that was passed in and can again veto promotions from that list. The remaining promotions are sorted by priority and then evaluated. - Each promotion contains a PMDL rule that describes the discount. For example, a rule might define a discount in which a customer buys one item and receives a second for free. The PMDL specifies the calculator type to use to determine the amount of the discount in the - calculator-typeattribute of the- discount-structureelement. The calculator type maps to a calculator component in the- calculatorTypeCalculatorsmap.- For each available promotion, Commerce does the following: - The pricing engine calls the appropriate helper method ( - findQualifyingItems,- findQualifyingOrder, or- findQualifyingShipping)in the- Qualifierclass to determine which items should be discounted. The pricing engine passes the current pricing context into the helper method’s input parameters.
- The - findQualifyingItems()method calls- evaluateTarget(), which returns a Collection of- QualfiedItemobjects, representing- CommerceItemobjects. The- findQualifyingOrder()and- findQualifyingShipping()methods return a single- MatchingObject.
- The - QualifiedItemand- MatchingObjectinclude discount information such as the PMDL discount structure. See the QualifiedItem Class for more information.
- The - QualifiedItemor- MatchingObjectinformation is returned to the pricing engine, which uses the discount information to determine which calculator to use.
- The pricing engine calls the calculator and passes in the items to be discounted and the discount information. 
- The calculator marks items that have received a discount, which might not be eligible for further promotions. 
- The qualifier marks items that have already been used as qualifiers for the promotion. This prevents the qualifier items from being used again during the same price calculation. 
- The calculator applies the discount to the list of objects. 
 
- The pricing engine applies its configured - PostCalculators, which make any necessary modifications to the price after discounts have been applied. Each pricing engine calls postcalculators of its own type.
- The pricing engine returns an updated - PriceInfoobject.
This process is repeated every time a price is requested. Price requests are resource-intensive, and should be performed only when necessary.

