Detecting Category and Tag Pages in Woocommerce

The Problem

When adding functionality to a Woocommerce store we sometimes want to add features that should only be present on category or tag pages. In this article, we’ll take a look at how we can detect category and tag pages in our Woocommerce code.

The Solution

This code will detect if the user is on a category page

The code for detecting a tag page is very similar


There’s not really an awful lot more to say about this as the code itself is pretty self-explanatory. If you do have any questions then please don’t hesitate to let us know in the comments.

Leave a Comment