Skip to content

How to validate the shipping methods in Magento 2 according to the custom checkbox created in shipping address for Local Pick-up

I have created a checkbox in the shipping form for local pick-up option. If user checks it, shipping address get populated as the store address.
Checkbox on checkout page for autofill shipping address

Now I want to show, the custom created, shipping method for Local Pick-up only if the user checks the checkbox. Otherwise Local pick-up should not show.
Shipping methods on the checkout page

Please tell me the best approach to do so in my custom module.

Thanks in advance!