Introduction to Line Item Fields

Date Published: 

Custom Line Items were a late addition to Drupal Commerce, but they offer amazing flexibility to the sitebuilder. In this first screencast about custom line items, I show how to add fields to the line item and explain why you might want to do so.

First we look at the Product fields. We are not talking about fields on products. We want to talk about fields on line items. A good example of this is selling a conference ticket, but we need to ask the customer the attendee's name for the conference.

To do this, we want to add an attendee name to the line item. Go to Store > Configuration > Line Item Types > Manage Fields

Add a field there for "Attendee Name" (Text)

Note: the beauty of Drupal Commerce is that we use the Drupal 7 Entity system to allow fields to be added to any of the entities.

Now, make sure to click the checkbox inside the "Add to Cart Form Settings." This enables customers to fill in the field for their specific purchase. This is called a line item field. I also show you in this video to show the fields on the cart page, the checkout page, any of the views.