Price Components

Price Components represent a change record of what happened during price calculation to give you the final price of a line item or order. When building your price calculation rules, you have the ability to choose what time of price component should be used to represent the price change on the order, which is why we provide a couple generic types (like discount / fee).

  1. Price components will keep track of the changes or additions to a price during price calculation
  2. You can specify which component to use in a price calculation rule

Ultimately customizing these further will result in the best customer experience, so instead of just "Discount" a user might have visual feedback that they've received their "Member discount" or "Wholesale discount." The ability to customize the price component label is possible in a custom module or there have been rumors of a contributed module that provides an interface for this to work.

The unit price of line items includes an array of price components that show the breakdown of how a particular price was calculated. These components will be multiplied by line item quantity into the line item's total price field and added together into an order's order total price field. Thus component data at the order level will show all the price components that went into the order total.

Price component types are defined by modules installed on the site using hook_commerce_price_component_type_info(). Core price component types include:

Enable Price Components for Display

In order to show you what price components look like, we've picked up the Price Calculations example towards the end. To see the whole exercise, check it out.

Lets reveal the price components

Reveal Price

To see the discount on your product, you must go to the manage display.


Set the price field to show formatted with components.

Price Field

Set the price field to show formatted with components.


Administrators see the discount

Final Discount

Simply changing the price to show with components, it displays all that is necessary for the discount to be obvious. Also in the screenshot is the same site, not logged in. This is an important step to make sure that your condition is actually working.

Enable Price Components via Rules

In order to show you what price components using rules look like, we've picked up the Price Calculations example in the very middle. To see the whole exercise, check it out.

Set .5 for 50% off, and select Discount for the price component type.

Configure Action

When you are setting the actual math part of the discount, we chose to simply multiply by 0.5 for a 50% discount. You could also divide by 2. Note also that we have changed the value of the price component type. The price component type will show up when you show the price with components. Note that if you want to add your own price component type it will likely need to be done in code.