Capitalise Single Product Title

When working with WooCommerce websites, it’s important to focus on design, readability, and accessibility. Managing hundreds or thousands of products can be challenging, so setting up global rules can save time and reduce the need for individual product edits.

One example is standardizing how product titles are displayed. You might currently have a mix of formats: some titles are capitalised (“Red Square Table”), others are not (“White round chair”), and some are entirely in uppercase (“GREEN COUCH”). To maintain consistency, you might want a PHP solution to automatically format these titles.

Below is a simple solution to capitalize all product titles consistently. Enjoy!

add_filter( 'the_title', 'wwccs_capitalize_single_prod_title', 9999, 2 );
 
function wwccs_capitalize_single_prod_title( $post_title, $post_id ) {
   if ( ! is_admin() && 'product' === get_post_type( $post_id ) ) {
      $post_title = ucwords( strtolower( $post_title ) );
   }
   return $post_title;
}