Additionally, the Broadleaf Offer Engine requires its own order-like structure that isn’t the same as the cart domain.
Therefore, the default implementation of the OfferProvider
, ExternalOfferProvider
, facilitates converting a cart, its items, and fulfillment groups into an OrderDto
that the Offer Engine can process.
This domain includes a runOrderAndItemOffers
flag to control whether order and order item offers are calculated.
In step 2 in the previous section where fulfillment discounts are calculated, this flag is set to false
to prevent any recalculation of the base merchandise pricing—otherwise, the fulfillment discount calculation can be incorrect and interfere with the application of non-fulfillment discounts.
Moreover, this allows the calculations to run faster since fewer offers or promotions need to be considered.
The ExternalOfferProvider
also defers some tasks to other components.
-
UserTargetGenerationService
: Generates the UserTarget DTOs that represent any type of user such as an individual customer, a business account, or an entire customer segment.
This consults the SecurityContextHolder
to get authenticated user info.
-
CartTotalsCalculator
: Assists in calculating the subtotal, fulfillment, and before and after tax totals for the cart.