I am having the same problem. Although doing this:
function commerce_discount...

Contribution Date
Technology
Contribution Project
Contribution Details

I am having the same problem. Although doing this:

function commerce_discount_commerce_cart_order_pre_refresh($order) { $order_wrapper = entity_metadata_wrapper('commerce_order', $order); $discount_types = commerce_discount_types(); $discount_types = array_keys($discount_types); foreach ($order_wrapper->commerce_line_items as $line_item_wrapper) { // NEW CODE ---- if (!$line_item_wrapper->value()) { continue; } // ----- $changed = commerce_discount_remove_discount_components($line_item_wrapper->commerce_unit_price, $discount_types); $changed = $changed || commerce_discount_remove_discount_components($line_item_wrapper->commerce_total, $discount_types); if ($changed) { $line_item_wrapper->save(); } } if (isset($order_wrapper->commerce_order_total)) { $changed = commerce_discount_remove_discount_components($order_wrapper->commerce_order_total, $discount_types); if ($changed) { $order_wrapper->save(); } } }

Is supressing the exception, still I am trying to figure out why an empty line item is created in the first place.

Steps to reproduce:
- Create an order discount coupon
- Apply that coupon during checkout
- Refresh the checkout page
- You will see

EntityMetadataWrapperException: Unable to get the data property commerce_unit_price as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 457)

And mysteriously a new null line item is created everytime you refersh the checkout page.

Contribution Author
Files count
0
Patches count
0