0

i want to make one custom module in that i set customer group and shipping method than that particulate customer group hide that shipping method enter image description here can any one help me how can i do that.

1

In shipping carrier class, there's a method to validate additional rules proccessAdditionalValidation, searching for that method in the code base will reveal processAdditionalValidation (less than 1 'c'). Then continue searching with that will lead collectCarrierRates

So in my opinion, there will be 2 approaches for this:

  1. Extend the current Carrier, add logic into proccessAdditionalValidation
  2. Make a new module, with GUI that helps customers/store-owner choose the rules and then process that rule inside Magento/Shipping/Model/Shipping.php:collectCarrierRates
1

I haven't done something similar but as I checked the code right now, you can create an after Plugin for this method \Magento\Shipping\Model\CarrierFactory::createIfActive or also this method \Magento\Shipping\Model\Shipping::isShippingCarrierAvailable, there you can add your validation and return true or false for the shipping method you allow or not.

Although I haven't tried it yet, maybe it will guide you to the right direction.

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.