We would like to give free-shipping on cart total $90 and over: If the total cart value goes below $90 after discount is applied, the free-shipping is not applicable and the flat-rate shipping of $7.95 should apply.
I am implementing custom API's for magento, this is reflecting once page got refreshed in magento user account. But the API(mycart.php) was showing the old results(showing 'flatrate' instead of 'free_shipping' above $90 )
I am applying shipping in cart level.
my sample code:
$quote = $this->_getQuote($cart_id, $store);
try {
if($sub_total >= 90){
$shipping_code = "freeshipping_freeshipping";
//$quote->getShippingAddress()->setFreeShipping(1);
//$quote->save();
}
else {
$shipping_code = "flatrate_flatrate";
}
if ($quote->getShippingAddress()->getCountryId() == '') {
$quote->getShippingAddress()->setCountryId($this->_country);
}
$address = $quote->getShippingAddress();
$address->setShippingMethod($shipping_code)->setCollectShippingRates(true);
$address->save();