You are here

function commerce_shipping_line_item_new in Commerce Shipping 7

Same name and namespace in other branches
  1. 7.2 commerce_shipping.module \commerce_shipping_line_item_new()

Creates a new product line item populated with the proper product values.

Parameters

$plugin: The commerce shipping ctools plugin.

$language: Optionally specify the language for the line item.

Return value

Line item object with default values.

1 call to commerce_shipping_line_item_new()
commerce_shipping_pane_checkout_form_submit in includes/commerce_shipping.checkout_pane.inc
shipping pane: submit callback.

File

./commerce_shipping.module, line 329
Defines the shipping system and checkout integration.

Code

function commerce_shipping_line_item_new($plugin) {

  // Create the new line item.
  $line_item = commerce_line_item_new('shipping');
  $line_item->line_item_label = $plugin['display_title'];
  $line_item->quantity = 1;
  $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
  $line_item_wrapper->commerce_shipping_method = $plugin['method_id'];
  return $line_item;
}