Creating a custom commerce line item type

Creating the type:

function my_custom_commerce_line_item_type_info() {
  $line_item_types = array();
  $line_item_types['my_discount'] = array(
    'type' => 'my_discount',
    'name' => t('Discount'),
    'description' => t('Discount line type'),
    'product' => TRUE,
    'add_form_submit_value' => t('Add discount'),
    'base' => 'my_discount',
  );
  return $line_item_types;
}

Add the commerce specific locked fields:

commerce_line_item_configure_line_item_type(array('type'=>'my_discount'));
commerce_product_line_item_configuration(array('type'=>'my_discount'));

About

This is the company blog of
Drupal specialist Merge.nl

We are located in Breda (Netherlands) and build websites using Drupal. More about us.

Content on this blog is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License.

Creative Commons License

Recent Comments

Social