I have a custom shipping method with several services, each with a unique name and label. These are essentially all the same (10% of order total), but with different labels to provide useful feedback to the customer. But no matter what, the "display_title" of the first declared service is always used.

commerce_shipping_line_item_populate populates the line items properly. Everything looks correct. Likewise commerce_shipping_add_shipping_line_item has the correct line item information with the label and everything.

I have a "details_form" on some of them, and this appears and is populated correctly. But that line item display label, for some reason, is not displaying the correct service.

Declarations for services are:

  $services['lp_wholesale_ups_standard'] = array(
    'title' => t('UPS Standard Ground'),
    'description' => t('UPS Standard Ground for Wholesale Orders'),
    'display_title' => t('UPS Standard Ground (Estimated)'),
    'shipping_method' => 'lp_wholesale_shipping',
    'price_component' => 'estimated_shipping',
    'callbacks' => array(
      'rate' => 'lifeguardpress_wholesale_shipping_rate',
      'details_form' => 'lifeguardpress_wholesale_shipping_details_form',
      'details_form_validate' => 'lifeguardpress_wholesale_shipping_details_form_validate',
      'details_form_submit' => 'lifeguardpress_wholesale_shipping_details_form_submit',
    ),
  );

  $services['lp_wholesale_ups_collect'] = array(
    'title' => t('UPS Collect'),
    'description' => t('UPS Collect for Wholesale Orders'),
    'display_title' => t('UPS Collect (Estimated)'),
    'shipping_method' => 'lp_wholesale_shipping',
    'price_component' => 'estimated_shipping',
    'callbacks' => array(
      'rate' => 'lifeguardpress_wholesale_shipping_rate',
      'details_form' => 'lifeguardpress_wholesale_shipping_details_form',
      'details_form_validate' => 'lifeguardpress_wholesale_shipping_details_form_validate',
      'details_form_submit' => 'lifeguardpress_wholesale_shipping_details_form_submit',
    ),
  );

  $services['lp_wholesale_fedex_third_party'] = array(
    'title' => t('FedEx 3rd Party'),
    'description' => t('FedEx 3rd Party for Wholesale Orders'),
    'display_title' => t('FedEx 3rd Party (Estimated)'),
    'shipping_method' => 'lp_wholesale_shipping',
    'price_component' => 'estimated_shipping',
    'callbacks' => array(
      'rate' => 'lifeguardpress_wholesale_shipping_rate',
      'details_form' => 'lifeguardpress_wholesale_shipping_details_form',
      'details_form_validate' => 'lifeguardpress_wholesale_shipping_details_form_validate',
      'details_form_submit' => 'lifeguardpress_wholesale_shipping_details_form_submit',
    ),
  );

  $services['lp_wholesale_fedex_collect'] = array(
    'title' => t('FedEx Collect'),
    'description' => t('FedEx Collect for Wholesale Orders'),
    'display_title' => t('FedEx Collect (Estimated)'),
    'shipping_method' => 'lp_wholesale_shipping',
    'price_component' => 'estimated_shipping',
    'callbacks' => array(
      'rate' => 'lifeguardpress_wholesale_shipping_rate',
      'details_form' => 'lifeguardpress_wholesale_shipping_details_form',
      'details_form_validate' => 'lifeguardpress_wholesale_shipping_details_form_validate',
      'details_form_submit' => 'lifeguardpress_wholesale_shipping_details_form_submit',
    ),
  );

No matter which of these shipping services the customer selects, it always displays on the order summary total area as "UPS Standard Ground (Estimated)".

It shows up that way when you view an order, both customer and admin sides. But if an admin EDITS an order, the label and sku of the shipping line item in the line items table is correct.

Comments

jazzdrive3’s picture

Title: Label Wrong in Order Total Details » Line Item Label Wrong in Order Total Details. Always Uses First Shipping Service title/display_title
jazzdrive3’s picture

Alright, I figured out this was because, for some reason, my hook_commerce_price_component_type_info(), that declares the estimated_shipping component, is not being called before commerce_shipping goes through its own hook.

So commerce_shipping is creating the estimated_shipping component when it loops through the services, and setting it as the name of the first one, and skipping the others.

jazzdrive3’s picture

Status: Active » Closed (fixed)
jazzdrive3’s picture

Issue summary: View changes

Added more info about editing an order.