I'm trying to change the weight of tax rates because I want a certain rate to always be on top of the second one (TPS & QST for Quebec, Canada) in the invoice and the cart. I made it work for shipping rates but I still can't with tax rates. I searched and tried several things.

Here's my module's code at this point:

function MYTHEME_commerce_price_formatted_components_alter(&$components, $price, $entity) {
if (isset($components['commerce_tax_rate_tps'])) {
$components['commerce_tax_rate_tps']['weight'] = 1;
}
if (isset($components['commerce_tax_rate_quebec'])) {
$components['commerce_tax_rate_quebec']['weight'] = 2;
}
}

Can someone help please? :-)

Comments

rszrama’s picture

Status: Active » Closed (fixed)

You'd actually need to adjust the weight of the price component types themselves using hook_commerce_price_component_type_info_alter().