Woocommerce Mandatory Field on Shipping Details [closed]

I went back through this myself and I have answered my own question.

By following the Woocommerce documentation, I actually confused myself and the second mandatory check isn’t applicable as we can use this primary function to set required from false to true. This automatically adds the red asterisk and makes the field mandatory without having to perform the additional check.

Quite simply:

//Add Tel Number to Shipping Address 
// Hook in 
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter! 
function custom_override_checkout_fields( $fields ) { 
$fields['shipping']['shipping_phone'] = array( 
'label' => __('Phone', 'woocommerce'), 
'placeholder' => _x('Phone', 'placeholder', 'woocommerce'), 
'required' => true, 
'class' => array('form-row-wide'), 
'clear' => true 
);

return $fields; 
}

/** 
* Process the checkout 
*/ 
add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');

I hope this helps someone else.

Regards,

Rob