diff --git a/sites/all/modules/contrib/commerce_discount/commerce_discount.rules.inc b/sites/all/modules/contrib/commerce_discount/commerce_discount.rules.inc index 542c298..b0ea3f8 100644 --- a/sites/all/modules/contrib/commerce_discount/commerce_discount.rules.inc +++ b/sites/all/modules/contrib/commerce_discount/commerce_discount.rules.inc @@ -970,7 +970,9 @@ function commerce_discount_percentage(EntityDrupalWrapper $wrapper, $discount_na } // Check whether this discount was already added as a price component. - $unit_price = commerce_price_wrapper_value($wrapper, 'commerce_unit_price', TRUE); + $refreshed_wrapper = entity_metadata_wrapper('commerce_line_item', $wrapper->getIdentifier()); + $wrapper->commerce_unit_price->set($refreshed_wrapper->commerce_unit_price->value()); + $unit_price = commerce_price_wrapper_value($refreshed_wrapper, 'commerce_unit_price', TRUE); foreach ($unit_price['data']['components'] as $component) { if (!empty($component['price']['data']['discount_name']) && $component['price']['data']['discount_name'] == $discount_name) { return; @@ -981,6 +983,8 @@ function commerce_discount_percentage(EntityDrupalWrapper $wrapper, $discount_na 'amount' => $unit_price['amount'] * $rate * -1, 'currency_code' => $unit_price['currency_code'], ); + + $info = $wrapper->getPropertyInfo(); commerce_discount_add_price_component($wrapper, $discount_name, $discount_amount); break; }