Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.4
Component:
Price
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2013 at 15:23 UTC
Updated:
20 May 2013 at 23:46 UTC
How do you make the subtotal the "discounted" total not the original price? It's confusing if the users see the discounted price on the table and the subtotal is not the discounted price. (see screenshot attached)
I tried to achieve this by implementing the hook_commerce_price_formatted_components_alter(&$components, $price, $entity):
function mymodule_commerce_price_formatted_components_alter(&$components, $price, $entity){
$components['base_price']['price']['amount'] = $components['base_price']['price']['amount'] + $components['discount']['price']['amount'];
}
But I'm not sure if this is actually safe to do or will it mess up calculations...? Based on my testing and viewing the $components variable, changing the amount of the base_price doesn't affect the calculation of the order total. But I hope one of the commerce guys will confirm.
| Comment | File | Size | Author |
|---|---|---|---|
| Checkout.jpg | 71.73 KB | akosipax |
Comments
Comment #1
rszrama commentedThis is a safe and perfect solution.