Free Shipping do not allow for a specific product in magento

Normally, free shipping is enabled from admin then it will show in front end for customer.Customer can choose and continue the checkout. But some cases, admin don’t want to allow free shipping method for some specific products is there in current cart. When that time below steps may helpful.Create attribute like below and make “YES” status for the specific product.

Yes – Do not allow free shipping method if this product is there in current cart
No – Allow free shipping method

Steps:
1. Create attribute called No_Free_shipping_product (attribute name with Yes/No type)
2. Map with any of the Attribute Set (Which one you want)
3. app\code\local\Jute\Shipping\etc\config.xml  –> Override Below file from core
4. app\code\local\Jute\Shipping\Model\Carrier\Freeshipping.php in this file add below code

We will call attribute like this – getNoFreeShippingProduct()
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
/* starting of the function – add this code */
$quote = Mage::getSingleton(‘checkout/session’)->getQuote();
$cartItems = $quote->getAllVisibleItems();
$stsflg = false;
foreach ($cartItems as $item) {
$Current_prdID = $item->getProductId();
$product = Mage::getModel(‘catalog/product’)
->setStoreId(Mage::app()->getStore()->getId())
->load($Current_prdID);
if($product->getNoFreeShippingProduct()){
$stsflg = true;
break;
}
}
if ($stsflg) {
return false;
}

——–
——–
Other code here
——-

} //function end

That’s it. After map this attribute to any of the product, just try to add this product to cart and check it.