0

We are using this plugin -

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Quote\Model\ShippingMethodManagement">
        <plugin name="shipping_method_management" type="Xyz\AdvancedTax\Plugin\Model\ShippingMethodManagement" disabled="false"/>
    </type>
</config>



<?php
namespace Xyz\AdvancedTax\Plugin\Model;

class ShippingMethodManagement {

    public function afterEstimateByExtendedAddress($shippingMethodManagement, $output)
    {
        return $this->filterOutput($output);
    }
    private function filterOutput($output)
    {
        $free = [];
        foreach ($output as $shippingMethod) {
            if ($shippingMethod->getCarrierCode() != 'freeshipping' && $shippingMethod->getMethodCode() != 'freeshipping') {
                $free[] = $shippingMethod;
            }
        }
        //print_r($free->getData());
        if ($free) {
            return $free;
        }
        return $output;
    }
}

It is only hiding for guest customer but it is not hiding when customer login.

0

You have to work on \Magento\Quote\Model\ShippingMethodManagement::estimateByAddressId.

1
  • you mean use this - afterEstimateByAddressId ? Dec 18 '20 at 14:58

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.