0

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->commerce_customer_shipping->commerce_customer_address->value();
 if (!empty($shipping_address['first_name'])) {
    $form['ship_to_forename'] = array(
    '#type' => 'hidden',
    '#value' => $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.

1 Answer 1

0

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->commerce_line_items as $delta => $line_item_wrapper) {
    if ($line_item_wrapper->type->value() == 'shipping' ){
    $form['merchant_defined_data6'] = array(
    '#type' => 'hidden',
    '#value' => $line_item_wrapper->commerce_shipping_service->value(),
  );

  break;
  }
}
0

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.