Magento – flat rate or free shipping

checkoutmagento-1.9shipping-methods

Hello everybody,

I need to for my webshop to have free shipping when you buy 3 or more products. When you buy less then 3 product it will cost you €6,75. I have made the free shipping and flat rate through admin>system>configuration but now it show free shipping and flat rate. Costumers can choose which one they want. I have set miminum amount of products to 3 by free shipping but that doesn't work. When i put 1 product in my cart and go to Shipping Method i still see both. Does anybody knows how to fix this? Tnx

Tnx guys for helping me with this problem. It's working now. Instead of working with products i did it with price.I took the amount between the prices of 2 and 3 products

enter image description here

enter image description here

Best Answer

Create a custom shipping method for this.
See here a tutorial on how to do it..

The only thing you need to change is the collectRates method.
Make it look like this:

public function collectRates(Mage_Shipping_Model_Rate_Request $request)
  {
    // skip if not enabled
    if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
        return false;
    }
     $result = Mage::getModel('shipping/rate_result');
     // create new instance of method rate
     $method = Mage::getModel('shipping/rate_result_method');
      // record carrier information
      $method->setCarrier($this->_code);
      $method->setCarrierTitle(Mage::getStoreConfig('carriers/'.$this->_code.'/title'));

      // record method information
      $method->setMethod($this->_code);
      $method->setMethodTitle(Mage::getStoreConfig('carriers/'.$this->_code.'/title'));

      //calculate the price:
      $itemsCount = 0;
      foreach ($request->getAllItems() as $item){
           //get only real products
           if (!$item->getParentItemId()) {
               $itemsCount++;
           }
      }
      if ($itemsCount >= 3) {
          $price = 0;
      }
      else {
          $price = 6.75; //or you can use a config value
      }


      $method->setPrice($price);
      $result->append($method);
    }

    return $result;
  }
Related Topic