Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Make Shipping Fields Optional in WooCommerce Checkout?

Sometimes, you may want to make certain fields optional in the Shipping section of the WooCommerce checkout page. This code snippet provides a way to customize the Shipping section.

add_filter( 'woocommerce_shipping_fields', 'ts_filter_shipping_fields', 10, 1 );

function ts_filter_shipping_fields( $address_fields ) {
    $address_fields['shipping_first_name']['required'] = false;
    $address_fields['shipping_last_name']['required'] = false;
    
    return $address_fields;
}

Output

When the customer selects the checkbox option, the Shipping fields will appear and the first name and last name fields will become optional as shown below.

How to Make Shipping Fields Optional in WooCommerce Checkout? - Tyche Softwares

Similarly, you can also make the billing form pin code field optional in WooCommerce Checkout page as some businesses or services may not be location-independent does not require a pin code during the checkout process.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.