Populate line item field in code
I seem to be stuck on something that should be easy. I have added a new field to the base line item type of 'product' that is an entity reference to a user account. This is for registering a user for a conference. The user will have an online account. I use the code below to add the attendee to the cart but cannot figure out how to populate the entity reference field I added.
$product = commerce_product_load_by_sku('myconference');
$line_item = commerce_product_line_item_new($product, 1);
commerce_cart_product_add($user->uid, $line_item, false);Any help is greatly appreciated!
