we want to remove free shipping method from custom shipping module magento2.

Any idea regarding above will be much appreciated.

  • @Haim - Do you have idea regarding the above mentioned
    – Danes
    Nov 6, 2018 at 5:41

1 Answer 1


Take a look at app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php

* Calculate price considering free shipping and handling fee
 @param string $cost
 @param string $method 
 @return float|string
public function getMethodPrice($cost, $method = '') {
    return $method == $this->getConfigData($this->_freeMethod)
    && $this->getConfigFlag('free_shipping_enable') 
    && $this->getConfigData('free_shipping_subtotal')
    <= $this->_rawRequest->getBaseSubtotalInclTax() ? '0.00' : $this->getFinalPriceWithHandlingFee($cost);

You can clearly see that there's a configFlag for free_shipping_enable

  • when the method is displayed through the custom shipping, for certain condition would like to remove the freeshipping method.
    – Danes
    Nov 6, 2018 at 5:55
  • Now you're asking something else and totally unrelated. You want the shipping method to only be available under certain conditions?
    – Haim
    Nov 6, 2018 at 5:56

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.