- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Magento 2: How to remove shipping methods if Free Shipping is available
Customers who qualify for free shipping will also have paid shipping option shown, which may be confusing.
Is there a way to hide other shipping methods when free shipping method is available?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2: How to remove shipping methods if Free Shipping is available
http://www.magestore.com/magento-2-tutorial/how-to-set-up-free-shipping-rules-in-magento-2/
this might help
@lgarridoj wrote:Customers who qualify for free shipping will also have paid shipping option shown, which may be confusing.
Is there a way to hide other shipping methods when free shipping method is available?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2: How to remove shipping methods if Free Shipping is available
Hi,
Did you get any answer on this?
Did you create a new module?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2: How to remove shipping methods if Free Shipping is available
Hello @pisha,
Magento\Quote\Model\ShippingMethodManagement.php
public function getList($cartId) { ............ $free=false; $freeOutput=[]; foreach ($shippingRates as $carrierRates) { foreach ($carrierRates as $rate) { if($rate->getCode()=='freeshipping') { $free=true; $freeOutput[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode()); }else{ $output[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode()); } } } if($free==false) { return $output; }else{ return $freeOutput; } }
If work then you need to create plugin after afttergetList/aroundGetList() and implement same logic.
If my idea work then mark as solution.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer