programmaticaly extract the shipping service name Through following code in a custom sub module for commerce_cybersource_sawm I am able to pass shipping information to merchant like name, address, country

$shipping_address = $order_wrapper-&gt;commerce_customer_shipping-&gt;commerce_customer_address-&gt;value();
 if (!empty($shipping_address['first_name'])) {
    $form['ship_to_forename'] = array(
    '#type' =&gt; 'hidden',
    '#value' =&gt; $shipping_address['first_name'],
  );
}


I want to know how can we extract the shipping service name. Since I have Free Shipping and Standard Shipping which I want to pass to the merchant.
I am not a developer, just found a code sample from @googletorp on the link below. Just modified that and got the result.

https://www.drupal.org/node/1555994#comment-5963680

    foreach ($order_wrapper-&gt;commerce_line_items as $delta =&gt; $line_item_wrapper) {
    if ($line_item_wrapper-&gt;type-&gt;value() == 'shipping' ){
    $form['merchant_defined_data6'] = array(
    '#type' =&gt; 'hidden',
    '#value' =&gt; $line_item_wrapper-&gt;commerce_shipping_service-&gt;value(),
  );

  break;
  }
}