1

I have a commerce site, I want to change the price componnents order of total order field in the order view page.
enter image description here
In the edit order page the last added line item -fee in my case , I add them manually- become the first in the in the price componnents field, I want do the inverse.
enter image description here

I didn't find any view to edit the added line items order. So I want to ask if there is a way to do that.

1

Implementing hook_commerce_price_component_type_info_alter hook you can change weight of price components to change sequence. Check following example:

<?php
/**
* Implements hook_commerce_price_component_type_info_alter()
**/

function <MODULE_NAME>_commerce_price_component_type_info_alter(&$components) {
  if (!empty($components['tax|tax_on_shipping'])) {
    $components['tax|tax_on_shipping']['weight'] = 30;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.