1

I want to remove extra html in checkout form field. for example I want to remove 'woocommerce-input-wrapper span and P tag in checkout fields.

I have tried to remove woocommerce-input-wrapper using hook but this span tag is not remove in checkfout field.

I used below script in functions.php in my active theme.

add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields)
 {
 unset($fields['billing']['billing_address_2']);
//echo "<pre>";print_r($fields);
  $fields['billing']['billing_email'] = array(
      'label'     => '',
      //'input_wrapper' =>'fdsf',
    'placeholder'   => _x('email', 'placeholder', 'woocommerce'),
    'input_class'  => array("form-control"),
    'class'     => array('form-group'),
    'priority'     => 4
     );
 //$fields['billing']['billing_email']['placeholder'] = 'Email Address ';
 $fields['billing']['billing_company']['placeholder'] = 'Business Name';
 $fields['billing']['billing_company']['label'] = 'Business Name';
 $fields['billing']['billing_first_name']['placeholder'] = 'First Name'; 
 $fields['shipping']['shipping_first_name']['placeholder'] = 'First Name';
 $fields['shipping']['shipping_last_name']['placeholder'] = 'Last Name';
 $fields['shipping']['shipping_company']['placeholder'] = 'Company Name'; 
 $fields['billing']['billing_last_name']['placeholder'] = 'Last Name';
 
 $fields['billing']['billing_phone']['placeholder'] = 'Phone ';
 return $fields;
 }

Can anyone help me to remove that span tag in checkout form field, I don't have much idea about woocommerce so please help me how can i remove that span tag.

  • I have tried but I have not any idea how can i implement this , Can you please give me a example for a filed so I can do this. – Rohan Varma Jan 28 '21 at 13:51
  • I already explain in my code what i need and I have tried action hook for remove that what else code you needed. I'm also a developer. – Rohan Varma Jan 29 '21 at 04:19
  • https://stackoverflow.com/questions/63992290/how-should-i-change-the-woocommerce-form-field-html-structure – Gavin Simpson Jul 16 '21 at 14:12
  • https://wordpress.stackexchange.com/questions/315781/woocommerce-checkout-how-can-i-change-field-container-of-a-checkout-field – Gavin Simpson Jul 16 '21 at 14:35

1 Answers1

0

Overwrite your WooCommerce's default checkout template by copying it to your theme's folder. Make the necessary deletes at the new file.

Ugene
  • 113
  • 11