Fixed issue #1286
This commit is contained in:
parent
ee4c4c43cb
commit
5b33eb4a56
|
|
@ -198,6 +198,8 @@ abstract class Discount
|
|||
|
||||
if ($alreadyApplied->count() && $alreadyApplied->first()->cart_rule->id == $rule->id) {
|
||||
if ($this->validateRule($alreadyApplied->first()->cart_rule)) {
|
||||
$this->reassess($alreadyApplied->first()->cart_rule, $cart);
|
||||
|
||||
return false;
|
||||
} else {
|
||||
$this->clearDiscount();
|
||||
|
|
@ -255,6 +257,20 @@ abstract class Discount
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To reassess the discount in case no. of items gets changed
|
||||
*
|
||||
* @return Void
|
||||
*/
|
||||
public function reassess($rule)
|
||||
{
|
||||
$rule->impact = $this->calculateImpact($rule);
|
||||
|
||||
$this->updateCartItemAndCart($rule);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* To return cart rule which has the max impact
|
||||
*
|
||||
|
|
@ -647,8 +663,11 @@ abstract class Discount
|
|||
|
||||
$result = $this->validateRule($alreadyAppliedRule);
|
||||
|
||||
if (! $result)
|
||||
if (! $result) {
|
||||
$this->clearDiscount();
|
||||
} else {
|
||||
$this->reassess($alreadyAppliedRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue