Hi I added custom field in billing form using this code below.
add_filter(\'woocommerce_billing_fields\', \'custom_woocommerce_billing_fields\');
function c
The following code will hide billing_options
custom optional checkout field when the selected payment method is Cash on delivery ("cod"):
// Conditional Show hide checkout fields based on chosen payment methods
add_action( 'wp_footer', 'conditionally_show_hide_billing_custom_field' );
function conditionally_show_hide_billing_custom_field(){
// Only on checkout page
if ( is_checkout() && ! is_wc_endpoint_url() ) :
?>
Code goes in function.php file of your active child theme (or active theme). tested and works.