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.
![](https://www.tychesoftwares.com/wp-content/uploads/2023/12/WooCommerce-Shipping-Fields-not-Required-in-Checkout.png)
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.