Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Remove Other Shipping if Free Shipping Available in Magento

magento tutorial

In this tutorial, I will explain how to Remove other shipping methods if free shipping method is available in your Magento store.

Remove other shipping if free shipping available in magento

If you want the Free shipping option on the basis of Cart total amount like If customer cart total amount is greater than 100 USD, then Free shipping will available, then use the below code in the same file as mention above.

if($subtotal >=100)
{
   // Remove any other shipping methods if free shipping is available.
   if (array_key_exists('freeshipping', $_shippingRateGroups )) {
       $_shippingRateGroups = array('freeshipping' => $_shippingRateGroups['freeshipping']);
    }
}

Copy the below code and paste it inside the app/design/frontend/default/your-theme/template/checkout/onepage/shipping_method/available.phtml file. It will remove the other shipping methods if free shipping method is available.

getQuote()->getSubtotal();

// Remove any other shipping methods if free shipping is available.
if (array_key_exists('freeshipping', $_shippingRateGroups )) {
	$_shippingRateGroups = array('freeshipping' => $_shippingRateGroups['freeshipping']);
}

?>

Liked this tutorial? Do Like & share with your friends 🙂

The post Remove Other Shipping if Free Shipping Available in Magento appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

Remove Other Shipping if Free Shipping Available in Magento

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×