0

我需要折扣后的运费计算

前任。
总购物车:65 美元
免费送货开始:65 美元
折扣:5%

折扣后价格低于 65 美元,仍然可以免费送货,我需要它在发货前计算折扣

4

1 回答 1

2

首先按运营商设置您的范围(0-65:X 欧元,65 岁以上:0 欧元)

重写类 Cart.php

Rewrite function getPackageShippingCost

线后

// Order total in default currency without fees
$order_total = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, $product_list);

添加这个

//Recalcul total pour panier et livraison gratuite 
$listeDiscounts = $this->getCartRules();        
$total_discounts = 0;
if (is_array($listeDiscounts)) {
    if (isset($listeDiscounts[0]['value_real']))
        $total_discounts = $listeDiscounts[0]['value_real'];            
}
$price_to_apply_shipment = floatval($order_total) - floatval($total_discounts);

代替

//$check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $total_order, (int)$id_zone, (int)$this->id_currency);
by                    
$check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $price_to_apply_shipment, (int)$id_zone, (int)$this->id_currency);

//$shipping_cost += $carrier->getDeliveryPriceByPrice($the_total_price, $id_zone, (int)$this->id_currency);
By 
$shipping_cost += $carrier->getDeliveryPriceByPrice($price_to_apply_shipment, $id_zone, (int)$this->id_currency);

清除缓存并运行

于 2018-12-25T10:43:05.967 回答