Removed the option of BuyAGetB as its current functionality was same as Fixed amount
This commit is contained in:
parent
216b409531
commit
4db41973fd
|
|
@ -34,7 +34,7 @@ return [
|
|||
'actions' => [
|
||||
'percent_of_product' => 'Percentage of product',
|
||||
'fixed_amount' => 'Apply as fixed amount',
|
||||
'buy_a_get_b' => 'Buy A get B'
|
||||
// 'buy_a_get_b' => 'Buy A get B'
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
|
|
|
|||
|
|
@ -597,23 +597,25 @@ abstract class Discount
|
|||
*/
|
||||
public function applyOnShipping($appliedRule, $cart)
|
||||
{
|
||||
if ($appliedRule->free_shipping && $cart->selected_shipping_rate->base_price > 0) {
|
||||
$cart->selected_shipping_rate->update([
|
||||
'price' => 0,
|
||||
'base_price' => 0
|
||||
]);
|
||||
} else if ($appliedRule->free_shipping == 0 && $appliedRule->apply_to_shipping && $cart->selected_shipping_rate->base_price > 0) {
|
||||
$actionType = config('discount-rules')[$appliedRule->action_type];
|
||||
|
||||
if ($appliedRule->apply_to_shipping) {
|
||||
$actionInstance = new $actionType;
|
||||
|
||||
$discountOnShipping = $actionInstance->calculateOnShipping($cart);
|
||||
|
||||
if (isset($cart->selected_shipping_rate->base_price)) {
|
||||
if ($appliedRule->free_shipping && $cart->selected_shipping_rate->base_price > 0) {
|
||||
$cart->selected_shipping_rate->update([
|
||||
'price' => $cart->selected_shipping_rate->base_price - $discountOnShipping,
|
||||
'base_price' => $cart->selected_shipping_rate->price - core()->convertPrice($discountOnShipping, $cart->cart_currency_code)
|
||||
'price' => 0,
|
||||
'base_price' => 0
|
||||
]);
|
||||
} else if ($appliedRule->free_shipping == 0 && $appliedRule->apply_to_shipping && $cart->selected_shipping_rate->base_price > 0) {
|
||||
$actionType = config('discount-rules')[$appliedRule->action_type];
|
||||
|
||||
if ($appliedRule->apply_to_shipping) {
|
||||
$actionInstance = new $actionType;
|
||||
|
||||
$discountOnShipping = $actionInstance->calculateOnShipping($cart);
|
||||
|
||||
$cart->selected_shipping_rate->update([
|
||||
'price' => $cart->selected_shipping_rate->base_price - $discountOnShipping,
|
||||
'base_price' => $cart->selected_shipping_rate->price - core()->convertPrice($discountOnShipping, $cart->cart_currency_code)
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class NonCouponAbleRule extends Discount
|
|||
if (count($endRules) == 1) {
|
||||
$this->save(array_first($endRules)['rule']);
|
||||
|
||||
return $endRules;
|
||||
return array_first($endRules)['impact'];
|
||||
}
|
||||
|
||||
$maxImpact = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue