How to add Keyword Meta Tags to Woocommerce Product Categories

Today I spent hours trying to figure out the best way to add keyword meta tags to product category pages in Woocommerce without adding yet another plugin to slow my site down. Here is the final solution I ended up doing to add meta keyword tags to product category page in WordPress.

Product categories use a special WooCommerce page template located in wp-content/plugins/woocommerce/templates/ in a file named archive-product.php. If you open that file you’ll notice the get_header WordPress function looks like:

get_header(‘shop’);

Okay so if you understand the WordPress get_header function you’ll know this indicates that there is a special header file involved here.  The get_header function appends what’s in the parenthesis to the prefix: “header-” then appends “.php” to the end in order to create the file name of the header file for the template it’s called within. That means in this case it points to a file named “header-shop.php”. Therfore the first thing you need to do is check your active theme directory for a file named header-shop.php. Most themes do not have this file and by default, it calls the header.php file if header-shop.php does not exist. For details and technical help with e commerce, there’s more on this website for all levels of expertise. Just keep a cool head and you will succeed, the information is out there, you just need to find it and use it.

Edit or Add header-shop.php File:

If you found the header-shop.php file, great, simply edit it to your needs and done. In my case if I had found one, which I didn’t, all I would have had to do would be to add meta tags under the title tag in the head section of the file.

If you did not find header-shop.php, then make a copy of header.php and name it header-shop.php and upload it to the same directory as header.php. Then you can edit header-shop.php to only make changes to pages that use that header tempalte such as the product category pages. In my case, I wanted to add custom meta tags to the product category pages, so I added the following inside of the head tags in header-shop.php and uploaded it to the current theme folder:

<meta name=”description” content=”insert your custom product category description here.” />
<meta name=”keywords” content=”your keywords go here, separate with commas” />

archive-product.php

8 Replies to “How to add Keyword Meta Tags to Woocommerce Product Categories”

  1. Followed your instructions. Sorry it didn’t work for me.

    We also have the “All In One SEO Pack” plugin free version which also doesn’t allow for the adding of “Meta Description” to Woocommerce “Product Categories”.

    Maybe the PRO version will.
    I have sent an email to the “All In One SEO Pack” developers.

  2. Howdy I am so excited I found your blog page, I really found you by accident,
    while I was researching on Yahoo for something else, Anyways I am here now
    and would just like to say thank you for a tremendous post and a all round interesting blog (I also love the theme/design),
    I don’t have time to go through it all at the minute
    but I have bookmarked it and also added in your RSS feeds, so when I
    have time I will be back to read a great deal more, Please do
    keep up the awesome job.

    1. If you have many categories and different keywords for each, you would need to build a more dynamic PHP solution that detects which category is being displayed and print the appropriate keywords in the meta tag for each. For this solution you would mostly likely employ the use of Conditional Tags. See this link for more information on how to get started with this:
      https://docs.woocommerce.com/document/conditional-tags/
      Hope that helps!

  3. Hey

    I am building one ecommerce website.

    Added the products, done with the designing, promoting it online but I am not getting the result.

    Have a look on it if you could help me

    1. Your site is starting to look good. If you want to hire me, I am sure I can help you with it. You can email me at linian11@yahoo.com with details and explain exactly what you would like to do and I’ll let you know what can be done. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *