News:

Looking for documentation? Take a look on our wiki

Main Menu

Free shipping and coupons

Started by keep, February 19, 2014, 16:28:00 PM

Previous topic - Next topic

keep

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?

seyi

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;
}
?>

Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate