0

I have multiple shipping methods, 1- Custom Shipping Method with Charge at £100 2- Store pick up - Free after £100 3- Free Shipping

So When Free Shipping method reaches cart value 100 then hide Custom shipping method. But at the time Store pickup also show.

I was tried with plugin but in that case, its hide all shipping method as soon as free shipping condition meet.

Thanks!

1 Answer 1

0

You can use around plugin aroundCollectCarrierRates

class HideShipping {

public function aroundCollectCarrierRates(
    \Magento\Shipping\Model\Shipping $subject,
    \Closure $proceed,
    $carrierCode,
    $request
) {

    // Hide all shipping methods except free shipping method
    if ($carrierCode == 'freeshipping') {
        return false;
    } 

    $result = $proceed($carrierCode, $request);
    return $result;
}

}

In this example, freeshipping will be hidden. You can write your own logic and even use your custom carrier codes to show/hide shipping methods as you need to.

Hope this helps.

2
  • Thanks! It's working for me. Jun 11, 2021 at 14:11
  • Then accept the answer please so that it helps others too.
    – zlep
    Jun 11, 2021 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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