1

I need to set a custom free-shipping threshold(in config this is carriers/freeshipping/free_shipping_subtotal and can be set in the back-end) for each quote subtotal.

So to quotes above this subtotal amount free shipping will be applied.

The subtotal-amount will change dynamically(by user) and should revert to default value set in back end when user is logged off.

How do I go about doing this?

  • can not understand by free-shipping subtotal threshold for each quote(cart.plz explain – Amit Bera Sep 28 '15 at 15:51
  • Hi Amit. I've made an edit. – Alan Sep 28 '15 at 16:03
  • what mean by The subtotal-amount will change dynamically(by user) and should revert to default value set in back end when user is logged off .please explain brefly – Amit Bera Sep 28 '15 at 16:41
1

You can accomplish a free shipping/per customer/per minimum subtotal by :

  1. Adding a new customer entity attribute, which will be the place to edit the minimum per order for each customer. Adding custom attribute to Customer
  2. After this you will need to rewrite the class Mage_Shipping_Model_Carrier_Freeshipping in app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php , specifically in the collectRates() method. instead of checking for $this->getConfigData('free_shipping_subtotal') we will check the customer subtotal from the attribute we created in point one.
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
    $minimumOrderAmount = Mage::getSingleton('customer/session')->getCustomer()->getNewAttrubuteYouCreated();
} else {
    $minimumOrderAmount = $this->getConfigData('free_shipping_subtotal');
}

if (($request->getFreeShipping())
    || ($request->getBaseSubtotalInclTax() >= $minimumOrderAmount)
) {
    $method = Mage::getModel('shipping/rate_result_method');

    $method->setCarrier('freeshipping');
    $method->setCarrierTitle($this->getConfigData('title'));

    $method->setMethod('freeshipping');
    $method->setMethodTitle($this->getConfigData('name'));

    $method->setPrice('0.00');
    $method->setCost('0.00');

    $result->append($method);
}

Some links to help: http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/

  • Thanks Rabee. Although it didn't work for some reason(despite the condition was met the shipping rate wasn't free) it pointed me in the right direction. I've overwritten Mage_SalesRule_Model_Quote_Freeshipping as advised here magento.stackexchange.com/questions/3670/…. – Alan Sep 29 '15 at 12:08
  • @Alan glad you found the answer, you didnt need to add a customer attribute at the end ? how did you make it customer specific ? I am going to double check my answer also. – Rabea Sep 29 '15 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.