dzinee
dzinee

Reputation: 157

WooCommerce - Overwrite Single product Tabs H2

WooCommerce gives the tabs in a Single Product page H2 heading by default. As these headings are not really relevant for my rankings I would rather make them H3 or H4.

How could I overwrite the template so that I can change it to H3?

I have looked at https://docs.woocommerce.com/document/template-structure/ but I can't figure it out.

Should I copy the complete original template file. And then just change H2 to H3? Put this into a subfolder?

Upvotes: 2

Views: 2717

Answers (1)

Hamza Ahmad
Hamza Ahmad

Reputation: 545

Assuming you have the latest WooCommerce and you are not using any other plugins or code to alter the tabs, create the following folder structure in your child theme:

/child-theme/woocommerce/single-product/tabs

Now copy the two files additional-information.php and description.php in the 'tabs' folder. You will find the following code in those files:

<h2><?php echo $heading; ?></h2>

Simply change the <h2></h2> to <h3></h3> or <h4></h4>

Do not edit core files of any plugin for your changes will be lost when the plugin is updated.

Hope this helps.

Update: For reviews tab, copy woocommerce/ templates/single-product-reviews.php to your child theme under woocommerce/single-product-reviews.php and edit that file.

Find: <h2 class="woocommerce-Reviews-title"></h2>

Edit the <h2></h2> with <h3></h3> or <h4></h4>, same as above.

Hope it helps.

Upvotes: 3

Related Questions