Im trying to achieve the add to favorites function, but I cant reference the commerce_product/product_display becose the items that are sold in my situation get customized by the user (add text, images, whatever).

I have a custom line item type called custom, where I added the field to handle the customization my users can do.

For the add to favorites functionality, i thought to add a line_item field in the user profile, put in it the custom line items created, and when he want to buy it all I have to do is create a new line item copying the fields value and then add it to the cart.

But i have some trouble: when i try to add (for test) the line items in the user's profile page throught the standard widget, I dont get any error message but the line items doesnt get saved..

Are them bounded to commerce_orders only?

2 Answers 2


Yes, I would not use a line item reference field outside of the order entity type. You might try using an entity reference field instead with the inline entity form module for line item creation / editing.

  • Hi, thanks for the reply - I ended creating a custom node type, on wich I put all the fields in common with the line item: when the user want to buy it, I simply copy all the fields into a new line item and put it in the cart. I'll put my answer ;)
    – Strae
    Sep 10, 2013 at 8:03

At the end, I ended creating a new content type (node), added all the fields I need/use in the line_item (product_id, display_product_id, my fields where I store customer's customizations, etc..)

When the customer want to buy the item, I simply create the line_item on the fly copying all the fields value from the node.

This allow me to handle more easly the display of those favorites items, becose they are just nodes: the only thing I did is to use hook_node_access to make those nodes visible only to administrator and to the customer who created them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.