5

How do I enable free shipping as shipping method when we create order from admin panel ?

11

Override

app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php

And add

    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
        if (!$this->getConfigFlag('active')) {
            return false;
        }

if (!Mage::app()->getStore()->isAdmin())) {
            return false;
        }

And set to active in backend

You can place the code in local if you dont want to overwrite the core

I can imagine that we add this as an extra option in backend settings and this way make it configurable.

  • NOw one needs to turn this into a simple extension that adds a config option to Freeshipping in settings (backend only yees/no). BUt this is above my programming skills – snh_nl Feb 25 '13 at 18:39
  • here ya go! and thanks for the clever idea. github.com/ryaan-anthony/Ip_Freeship – ryaan_anthony Mar 13 '15 at 18:21
3

While in payment methods it is possible to activate them with a flag only on frontend and also on backend (but not vice-versa), for shipping methods there are no such flags at all.

You could derive an own shipping method in a custom module and overwrite getAllowedMethods() to determine if the order is to be created in the frontend or in the backend,

A very simple workaround would be to create a free-shipping cart rule with a promo code that only you know. This then can be simply entered in the backend.

  • Thanks Alex, SOme remakrs, I came across this code public function isAvailable($quote = null) { return (parent::isAvailable($quote) && Mage::app()->getStore()->isAdmin()); }code – snh_nl Feb 10 '13 at 19:26
  • And promo code is not an option. Because then Magento doesnt allow another promotion code (for example discount) ---- as such, we have never got it to work – snh_nl Feb 10 '13 at 19:28
0

You would make collectRates() return empty unless it's being invoked via admin. How to know if its invoked via admin, well you could set a registry value.

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.