How do I enable free shipping as shipping method when we create order from admin panel ?
4 Answers
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_nlCommented Feb 25, 2013 at 18:39
-
here ya go! and thanks for the clever idea. github.com/ryaan-anthony/Ip_Freeship Commented Mar 13, 2015 at 18:21
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_nlCommented Feb 10, 2013 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_nlCommented Feb 10, 2013 at 19:28
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.
I just found a free open source extension on GitHub for that: Llian_FreeAdminShipping.