Vote up!
Vote down!

How to attach a node reference to product line item

I sell ghost writing services, and I've created one product for each of the standardized length stories, and one product display with a pull down to select story length attribute. Prior to placing an order, the customer creates a "storyline" node. I would like to enable the customer to specify a reference to a storyline node at the time he places a story into the cart. Can't figure out how, so I'm asking for guidance. Thanks.

Asked by: jsulmar
on September 12, 2013

2 Answers

Vote up!
Vote down!

There's a lot of information here: http://commerceguys.com/blog/commerce-module-tuesday-commerce-customizab...

There's also http://www.drupalcommerce.org/videos/demo/introduction-line-item-fields

But roughly, if you have Commerce Kickstart installed, you would have to:

1. Go to Store Settings > Line item types
2. Click on "Manage fields" for the Product line item type.
3. Add an entity reference field for the Node you want to link. When configuring it, make sure to tick the box "Include this field on Add to Cart forms for line items of this type." under "Add to Cart form settings".
4. The field widget should probably be a select list.

This will add a select box with the storyline nodes to the "Add to Cart" form. I think that was the easy part. :D

The next part, which is how to display this new information (or line item "attribute") on key places like the /cart and /checkout, is explained on the first video linked at the top.

Answer by: Favio Manriquez
Posted: Sep 13, 2013


Thanks favrik, the Commerce Customizable Products worked like a charm for me.

- jsulmar on September 19, 2013
Vote up!
Vote down!

Thanks favrik, the Commerce Custom Products module worked great for me.

Answer by: jsulmar
Posted: Sep 19, 2013