1

BLC 5.1.5

For OrderItem#getRetailPrice there is this documentation:

The retail price of the item that was added to the Order at the time that this was added. This is preferable to use as opposed to checking the price of the item that was added from the catalog domain (like in DiscreteOrderItem, using DiscreteOrderItem.getSku()'s retail price) since the price in the catalog domain could have changed since the item was added to the Order.

There is no documentation on the getter for baseRetailPrice.

What is the general idea behind base retail vs. retail and when should base retail price be used?

1 Answers1

3

In DiscreteOrderItemImpl#setSku:

@Override
public void setSku(Sku sku) {
    this.sku = sku;
    if (sku.hasRetailPrice()) {
        this.baseRetailPrice = sku.getRetailPrice().getAmount();
    }
    if (sku.hasSalePrice()) {
        this.baseSalePrice = sku.getSalePrice().getAmount();
    }
    this.itemTaxable = sku.isTaxable();
    setName(sku.getName());
}

When the Sku is set on the DiscreteOrderItem, we lookup the retailPrice of the Sku, and set it to the baseRetailPrice of the DiscreteOrderItem.

In retrospect the answer to this question is probably obvious. The baseRetailPrice is the retail price of the Sku at the time the DiscreteOrderItem was created. As a consequence the retail price of the DiscreteOrderItem and the Sku fall out of sync, which is probably what you want for most business situations, for example in quotes. If you're new to ecommerce, this detail might not be obvious and you may mistakenly check the price of an OrderItem when you're actually interested in the current price of the associated Sku.

If you need to access the current price in the database of the Sku in a DiscreteOrderItem, you need to call DiscreteOrderItem#getSku#getRetailPrice. If you want to synchronize the DiscreteOrderItem price with its associated Sku, there is DiscreteOrderItem#updateSaleAndRetailPrices.

If anyone has additional details, please add them.