By default, the phone number field at WooCommerce checkout is optional. This snippet forces it to be required, so customers cannot complete an order without entering a valid phone number. Useful for store owners who need contact details for order follow-up or delivery coordination.
<?php
add_filter( 'woocommerce_checkout_fields', function( $fields ) {
$fields['billing']['billing_phone']['required'] = true;
$fields['billing']['billing_phone']['class'] = array( 'form-row-wide', 'validate-required', 'validate-phone' );
$fields['billing']['billing_phone']['label'] = 'Phone';
return $fields;
}, 9999 );