How to avoid Address Validation when certain Shipping Method is selected? (Code Snippet)

Chris has a WooCommerce store in which he uses ELEX Address Validation & Google Address Autocomplete Plugin for WooCommerce. He has a custom requirement in which he wants to avoid address validation when a certain shipping method is selected. Which means when a customer selects a specific shipping method, his/her address will not be validated and the order is placed right away.

If you have a similar requirement, follow the below method.

Avoiding Address Validation for Certain Shipping Method

Consider a scenario where you want to avoid address validation for Local Pickup shipping method.

Add the following code snippet in the Theme Functions (functions.php) file of your active website theme.

When the above code snippet is added, the plugin avoids address validation whenever WooCommerce default shipping method Local Pickup (local_pickup) is selected. Hence whenever local pickup is selected by your customers, their order is placed directly without address validation.

 


To explore more details about the plugin, go check out ELEX Address Validation & Google Address Autocomplete Plugin for WooCommerce.

or read the product documentation to know every feature of the plugin, in detail.

You can also check out other WooCommerce and WordPress plugins in ELEX.

    Leave a Reply