... back


Good news, everyone



Remove the checkout title from wordpress's woocommerce


Why this?

When testing a woocommerce shop pluguin for wordpress it came to my mind to keep it gender neutral.

Screenshot:
Screenshot with checkout title

I wanted to get rid of the 'Title' field (in the screenshot: 'Anrede'; please excuse the language mixture).
Here is how I did it.

Use filters and hooks

You should have child theme installed, for example in the /wp-content/themes/storefrontchild/ directory. Add the follwing lines of code to your functions.php file:
HTML:
// To use the gender neutral form remove the Sir-or-Madam title (in the billing form).
function custom_override_billing_fields( $fields ) {
     unset($fields['billing_title']);
     return $fields;
}
add_filter( 'woocommerce_billing_fields' , 'custom_override_billing_fields' );


// To use the gender neutral form remove the Sir-or-Madam title (in the checkout form).
function custom_override_shipping_fields( $fields ) {
     unset($fields['shipping_title']);
     return $fields;
}
add_filter( 'woocommerce_shipping_fields' , 'custom_override_shipping_fields' );


The Result

And here we go.

Screenshot:
Screenshot without checkout title

Tadaa! (~ ̄▽ ̄)~
Note: The syntax highlighting was made with tohtml.com.



Enjoy the code, have a good time and help others!