I need to add my custom item to Checkout Total Sort Order in configuration page. I created custom price, which shown in checkout according to this manual https://indiestechtips.wordpress.com/2011/07/30/how-to-add-custom-field-in-the-billing-and-shipping-address-of-onepage-checkout-in-magento/ Difference only in that my custom field is calculated via math formula. So now, having new field in checkout, I need to add this field to Checkout Total Sort Order. Question is that how to do this ?

1 Answer 1


add to your extension system.xml

                        <yourfield translate="label">
                            <label>Your Field Label</label>

instend of you need to use your code. ex "discount","grand_total"

Look in to Mage_Sales_Model_Quote_Address_Total_Collector

protected function _initRetrievers()
        $sorts = Mage::getStoreConfig(self::XML_PATH_SALES_TOTALS_SORT, $this->_store);
        foreach ($sorts as $code => $sortOrder) {
            if (isset($this->_models[$code])) {
                // Reserve enough space for collisions
                $retrieverId = 100 * (int) $sortOrder;
                // Check if there is a retriever with such id and find next available position if needed
                while (isset($this->_retrievers[$retrieverId])) {
                $this->_retrievers[$retrieverId] = $this->_models[$code];
        $notSorted = array_diff(array_keys($this->_models), array_keys($sorts));
        foreach ($notSorted as $code) {
            $this->_retrievers[] = $this->_models[$code];
        return $this;
  • Thanks a lot. It works. But I have another question: if I have 1 field with order "10" and my field with order "5", should I expect that my field must be higher that standard field? Or to realize it must be additional code. Commented Feb 24, 2016 at 8:20
  • 1
    Updated answer please check it Commented Feb 24, 2016 at 17:09

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.