How do I know the discount rate?
The discount rate isn't always available as a percentage (like, for instance, taxes are) because discounts can be whole numbers as well. Regardless, you can ultimately get information about how a price is calculated by looking at the commerce_order_total field on an order or the commerce_total field on a line_item.

Here's an example:



In this screen shot, we'll take a look at 4 items. For the comments assume $price = $order-&gt;commerce_order_total[LANGUAGE_NONE][0].


$price['data']['components'][0]['price']['amount'] is the original amount. You know this because $price['data']['components'][0]['price']['amount'] is "base_price".
A discount price component will a name of "discount|DISCOUNT_ID" where DISCOUNT_ID is the machine name of the discount that is being referenced.
$price['data']['components'][1]['price']['amount'] in this instance is the discount that is applied.
$price['amount'] is the combination of all of the components under $price['data']['components'].


There is a data array under the price information on the discount. It contains the label and the machine name of the discount, but it doesn't have any other information. Custom discounts might put more information on there, but you can't necessarily depend on anything else being there.