您将不得不从 覆盖getPackageShippingCost()
方法Cart.php
。
并更改这些行:
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else { // by price
$shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency);
}
}
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else {
$shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency);
}
}
通过替换$order_total
为$orderTotalwithDiscounts
:
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else { // by price
$shipping_cost += $carrier->getDeliveryPriceByPrice($orderTotalwithDiscounts, $id_zone, (int)$this->id_currency);
}
}
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else {
$shipping_cost += $carrier->getDeliveryPriceByPrice($orderTotalwithDiscounts, $id_zone, (int)$this->id_currency);
}
}
如果您不知道如何覆盖类,请查看此文档。