remove billing address(css ) and email field using checkbox
-
Of course their is a field and name my_checkbox, when you tick it, value updates to “1” so i have these function after the drama ting
Function function_hook() { // get plugin option array and store in a variable $plugin_option_array = get_option( 'plugin_options' ); // fetch individual values from the plugin option variable array $my_checkbox = $plugin_option_array[ 'my_checkbox' ]; ?> <?php if ( $my_checkbox == '1' ) { echo '<style type="text/css"> #customer_details { display:none; } </style>'; function override_checkout_fields($fields) { unset($fields['billing']['billing_email']); return $fields; } add_filter( 'woocommerce_checkout_fields' , 'override_checkout_fields' ); }
add_action( ‘wp_head’, ‘function_hook’ );
it works yes, removes the email, when box is ticked. but after pushing the “place order” button, it gives an error of
===== Email Address is a required field. ======
but i used the “unset” feature as in the documentation here
can someone help me solve this problem?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘remove billing address(css ) and email field using checkbox’ is closed to new replies.