Question

In Magento 1.7, is there any way to show Flat Rate Shipping only if chart is over a certain amount? By rule the only option seems to be free shipping, but my goal is to have Flat Rate if sub total in chart is xx (if sub total is lower, normal rates will be used). Thanks! -Espen

Was it helpful?

Solution

Not by default. It's easy to extend the flat rate shipping carrier method though to do this. Simply create a new module, extend the flat rate shipping system.xml so that there is a new option for minimum cart price (this will allow you to configure it through admin). Extend the following class Mage_Shipping_Model_Carrier_Flatrate and override the collectRates method to check the cart total vs the admin config value. Return false if the cart value is not enough and it will not show up as an option, otherwise it will return the cost set in the admin.

Edit: Something like the following would do it. Extend the class, don't mod the core!

public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    // Get The Minimum Order Value From Admin Config & Compare To Cart Subtotal (Base Prices)
    if (!$this->getConfigFlag('minimum_order') || $request->getBaseSubtotalInclTax() < $this->getConfigFlag('minimum_order')) {
        return false;
    } else {
        return parent::collectRates($request);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top