I have a question about free shipping and coupons.
I want to use a free shipping limit in my shop e.g $100.
In my scenario the cart total is $101 so the free shipping is active. That's great.
If I use a coupon with $20, the total price becomes $81. It is below the limit but the shipping price is still $0.
I need to calculate the shipping price based on the final price.
I checked the getCosts function in the weight_countries plugin but the $cart_prices array does not contains any coupon-related price.
How can I solve this problem?
Hello,
The payment plugin already takes the discount into account, so just borrowing that code, in the weight_countries.php, this should work for function getcosts
<?php
function getCosts (VirtueMartCart $cart, $method, $cart_prices) {
if ($method->free_shipment) {
$this->convert_condition_amount($method);
$amount = $this->getCartAmount($cart_prices);
if ($amount >= $method->free_shipment) return 0;
}
return $method->cost + $method->package_fee;
}
?>