Question

I need to add a shipping method to my site that is only allowed to be used by the Sales staff. (A customer gets free shipping for orders, but has to be charged for return shipping after repairs)

I've got a spare Flat Rate I could use, but I don't want it to be able on the front end. I only want it to show as a Shipping Option during a MOTO order. Is there a way of doing this?

Was it helpful?

Solution

There are a few ways to do this. One solution is to create a module that gives you a multi-select box in the admin area to chose which methods will be active. That solution is provided here, but is likely more involved than needed for your situation.

The method that I think will work better for you is provided here. This goes over how to write a simple module that will hide methods based on conditions you define. The example is set up to hide the flatrate shipping method from customers who are not logged in. To adjust for your situation, lets assume you create a shipping method called staffOnly. Then the _checkCarrierAvailability method for you would look like:

protected function _checkCarrierAvailability($carrierCode, $request = null)
{
    if($carrierCode == 'staffOnly'){
        return false;
    }
    return true;
}

Now when the code iterates through to grab all the available shipping methods, it will skip the one called staffOnly, and it will never be rendered as an option at frontend checkout.

OTHER TIPS

I just found a free open source extension on GitHub for that: Llian_FreeAdminShipping.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top