Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load whatever product represents the item the customer will be
- // paying for and create a line item for it.
- $line_item = commerce_product_line_item_new($product, $quantity, $order->order_id);
- // Save the line item to get its ID.
- commerce_line_item_save($line_item);
- //***this is the part that's not working. trying to set the field_notes field***
- $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
- $line_item_wrapper->field_notes->set("Does this work??");
- // Save the line item to get its ID.
- commerce_line_item_save($line_item);
- // Add the line item to the order using fago's rockin' wrapper.
- $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
- $order_wrapper->commerce_line_items[] = $line_item;
- // Save the order again to update its line item reference field.
- commerce_order_save($order);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement