How to change <H1> tag in the WooCommerce product page

saycookie picture saycookie · Nov 17, 2016 · Viewed 10.2k times · Source

How can I change the product title h1 tag in woocommerce? I already have a h1 tag on my page and want the product name to be h2.

the current title comes from:

do_action( 'woocommerce_single_product_summary_single_title' );

Answer

Raunak Gupta picture Raunak Gupta · Nov 17, 2016

You can override the default WooCommerce title.php template by your own theme.

Copy woocommerce/templates/single-product/title.php and paste it into your active theme under woocommerce/single-product/title.php

Change this line the_title( '<h1 itemprop="name" class="product_title entry-title">', '</h1>' ); to the_title( '<h2 itemprop="name" class="product_title entry-title">', '</h2>' );

The code is tested and fully functional.


Reference