You can do that by overriding the
\Magento\Quote\Model\ShippingMethodManagement::getShippingMethods function.
private function getShippingMethods(Quote $quote, $address)
{
$output = [];
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->addData($this->extractAddressData($address));
$shippingAddress->setCollectShippingRates(true);
$this->totalsCollector->collectAddressTotals($quote, $shippingAddress);
$shippingRates = $shippingAddress->getGroupedAllShippingRates();
foreach ($shippingRates as $carrierRates) {
foreach ($carrierRates as $rate) {
$output[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode());
}
}
return $output;
}
This method is responsible for providing all the available shipping methods. So all you have to do is, check the grand total of the quote and enable the respective methods.
Below are the modified lines to display only free shipping when order amount goes above 100.
foreach ($shippingRates as $carrierRates) {
foreach ($carrierRates as $rate) {
if ($quote->getGrandTotal() <= 100) {
$output[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode());
} else {
if ($rate->getMethod() == "freeshipping") {
$output[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode());
break;
}
}
}
}
Since this method is a private function, you can't use plugins. You can go with preference to achieve that.