Hi people, i have added some Flat rate services and i see that it is not possible to rearrange them. Plus i see no option to make a select list from all the Flat rate services y have. Is this the way it works???

I'm trying to make a select list of "zone-delivery cost". Am i with the right module??

any help will be appreciated.
thanks for your time.

Comments

helior’s picture

Status: Active » Fixed

Although there is no UI for sorting shipping services, you can always do this yourself with a form alter.


/**
 * Implements hook_form_FORM_ID_alter().
 */
function myModule_form_commerce_checkout_form_alter(&$form, &$form_state) {
  // If the Commerce Shipping pane exists on the current checkout form..
  if (isset($form['commerce_shipping'])) {
    // Change the form type to a select box.
    $form['commerce_shipping']['shipping_service']['#type'] = 'select';
    
    // Re-organize the shipping services.
    uasort($form['commerce_shipping']['shipping_service']['#options'], 'my_custom_sorting_callback');
  }
}
FAAREIA’s picture

Category: support » feature
Status: Fixed » Active

Thanks for your answer and code Helior. I'll try to figure it out how to do this since i do not know much about php.
I change this issue to feature request since i see this feature very helpfull.

googletorp’s picture

Status: Active » Closed (duplicate)