I want to move the VAT row below the delivery cost in the One Step Checkout review your order section. What would be the best approach to rearrange them?

enter image description here

Thanks in advanced for your help.

2 Answers 2


You should be able to change this from Admin -> System -> Configuration -> Sales -> Sales -> Checkout Totals Sort Order.

Sample: enter image description here

  • I wasn't sure this would work because he's using Onestepcheckout, but if it does, your solution is way easier than mine! :)
    – Dan Hanly
    Feb 4, 2015 at 14:19

In order to do this, you'd need to reorder the totals array itself prior to the for loop which outputs them.

The foreach loop starts as follows:

<?php foreach ($this->getTotals() as $total): ?>

The $this->getTotals() returns an array of totals that is pre-sorted. As you are looking for a different order, then you'll need to modify this declaration.

Firstly, you'll need to ascertain the keys and the current order:

<?php var_dump(array_keys($this->getTotals())); ?>

That code will output the order of the totals along with their identification keys.

Now you can look at re-ordering them. Change your foreach loop to resemble this:

// Get all totals
$all_totals = $this->getTotals();

// Create a new array of totals (empty)
$totals = array();

// Explicitly set the order of the totals into the totals array
$totals[0] = $all_totals['subtotal'];
$totals[1] = $all_totals['shipping'];
$totals[2] = $all_totals['tax'];
$totals[3] = $all_totals['grand_total'];

// Loop through your new order
foreach ($totals as $total): ?>

You'll need to adapt your own total keys into this format, and ensure that the indices of your new $totals array are correct for what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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