function commerce_line_item_new in Commerce Core 7
Returns an initialized line item object.
Parameters
$type: The machine-readable type of the line item.
$order_id: The ID of the order the line item belongs to (if available).
Return value
A line item object with all default fields initialized.
1 call to commerce_line_item_new()
- commerce_line_item_manager_validate in modules/
line_item/ commerce_line_item.module - Validation callback for a commerce_line_item_manager element.
File
- modules/
line_item/ commerce_line_item.module, line 584 - Defines the core Commerce line item entity and API functions interact with line items on orders.
Code
function commerce_line_item_new($type = '', $order_id = 0) {
return entity_get_controller('commerce_line_item')
->create(array(
'type' => $type,
'order_id' => $order_id,
));
}