Add a custom line item type with custom fields when my module is active I'm developing a module that adds on to Drupal Commerce that requires a custom line item type (LIT) along with additional fields on the LIT. With this hook I can add the LIT.

function package_designer_commerce_line_item_type_info_alter(&amp;$line_item_types) {
     $lineItemType = array
    (
        'name' =&gt; "new product line item type",
        'description' =&gt; "A customized product line item type",
        'product' =&gt; true,
        'add_form_submit_value' =&gt; "Add product",
        'base' =&gt; "commerce_product_line_item"
    );
    $line_item_types['new_product_line_item_type'] = $lineItemType;

}


And it appears in the LIT list under the configuration menu. But when I click on Manage Fields it doesn't have the same list of as the regular commerce line item type, which is what I thought the base entry was meant to do. That is secondary though to my actual problem.

I want my LIT to have a specific field attached to it without having to provide instructions on how to go through the admin interface and create it. This might mean that instead of using that hook I need to use the .install file but I'm new to Drupal and would like to start with the recommended method instead of developing bad habits.

Update

It turns out base doesn't do what I thought it did. It only sets the line item up for using the default callbacks that start with 'commerce_product_line_item_type'. To actually make my LIT have the same base fields as the commerce product one I need to add this to my module

function package_designer_enable() {
    commerce_product_line_item_configuration(array('type'=&gt;'new_product_line_item_type'));
}
As stated by @pcambra, the hook to define custom line items is hook_commerce_line_item_type_info.

The base key is used to build the name of some callback functions. If not specified, it defaults to the line item type name.

One of the possible callbacks is "configuration", and it is invoked when the line item is first detected by Commerce. In this callback is where you should create the fields/instances related to your line item type. Commerce already does it in commerce_product_reference module. See commerce_product_reference_commerce_line_item_type_info and commerce_product_line_item_configuration for reference.

Also, you can consult this blog post for some tricks to ease the creation of fields/instances.