Support » Plugin: WooCommerce » Need a bit of help with hooks and filters

  • Hi, I am a little bit stuck. I would like to make the phone and email fields the same length as the other fields and stack them. I can see that there is a class causing them to be side-by-side but I can’t figure out how to remove that class?

    Also, in the final checkout page (after the order is placed) there is a label “Order details” I would like to Capitalize “details” but can’t quite get the hang of filters.

    Any help would be really appreciated, even if you can point me to the appropriate Doc (I’ve been searching, but it’s a little tough when you aren’t sure what to search for, lol)

    Thank you!

    https://wordpress.org/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @roxyjo, you can add below code into theme functions.php to change the class for phone and email:

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    function custom_override_checkout_fields( $fields ) {
         $fields['billing']['billing_email']['class'] = array('form-row-wide');
         $fields['billing']['billing_phone']['class'] = array('form-row-wide');
         return $fields;
    }

    More info you can refer to official documentation from WooCommerce here.

    You are beutiful! Thank you so much!
    Now that I see the proper code, I can see where I went wrong, and why.
    I was trying to do the code this way:

    add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );

    function custom_override_checkout_fields( $fields ) {
    $fields[‘billing’][‘billing_email’][‘class’] = ‘form-row-wide’;
    return $fields;
    }

    I should have used an array.
    Thank you!

    Hi @roxyjo, it’s my pleasure, cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need a bit of help with hooks and filters’ is closed to new replies.