I have created a custom version of Order which exists only in Admin. These Orders will never use any shipping option other than Free Shipping, so the client doesn't want to click "Get shipping methods and rates" then select "Free Shipping", which is the only available option.

I have:

  • Enabled free shipping for Admin only.
  • Filtered shipping methods so only freeshipping is shown for this type of Order.

To make the selection, I tried:

  • replacing create/shipping/method/form.phtml with a static form.phtml that is only the container and select for free shipping, already checked.
  • Adding calls to order.loadShippingRates() and order.setShippingMethod('freeshipping') to fire after the ajax response from order.productGridAddSelected().

The first method throws a "Select a shipping method" error, and while the second works, it adds a second or two to each call to order.productGridAddSelected(), which isn't optimal.

Since this is a completely separate version of Order, I don't mind having it load a modified version of sales.js, but even when I have added calls to order.loadShippingRates() and order.setShippingMethod('freeshipping') in sales.js I get the "Select a shipping method" error.

I am thinking the fix needs to happen in sales.js, but I'm not sure where.

per request, the code I am using to return only freeshipping :

public function getShippingRates()
    if (empty($this->freeShipHolder)) {
        $groups = $this->getAddress()->getGroupedAllShippingRates();

        foreach ($groups as $carrier) {
            foreach ($carrier as $rate) {
                if ($rate['carrier'] == 'freeshipping') {
                    $this->freeShipHolder['freeshipping'][] = $rate;
        return $this->freeShipHolder;
    return $this->freeShipHolder;


That part works with no issues, but if it's informative....

  • I don't know how you've structured your module but maybe you can set a default value in the config.xml? Or, can you show the code you have for filtering shipping methods so only free shipping is shown? – Vic Apr 25 '15 at 17:04
  • Code posted above. I'm not sure on the xml fix though.... – AreDubya Apr 25 '15 at 17:18
  • If freeshipping is the only available option, why is it not selected automatically? Does the dropdown contain a blank option? – Vic Apr 25 '15 at 20:58
  • There's no dropdown, just a radio button. I am guessing because I am only filtering out the other options on this specific variant of order. There are other options available for the store frontend and other types of admin orders. – AreDubya Apr 26 '15 at 0:28
  • Well I'm not sure how your order form looks like or is generated so I'm having trouble imagining it but I think you're better off loading the form with the option already selected instead of relaying on javascript. Maybe you can set it in the form class, in the _prepareObject method or something. Did you build custom admin blocks for it? Check those blocks. Or else maybe you can set it in the controller but I'm not so sure if that one's possible – Vic Apr 26 '15 at 1:04

Your Answer

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

Browse other questions tagged or ask your own question.