5

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?

3

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.

|improve this answer|||||

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.