Home » WooCommerce: Display Different Widgets Based On Product Category

WooCommerce: Display Different Widgets Based On Product Category

by Tutor Aspire

Using Widget Logic, you can easily set what widget you want to display based on what WooCommerce product categories users are browsing.

For example, you can set what widgets users will see when he will land to the “Book” product category page. These widgets will not be visible in other pages, it will be only shown to a user when he lands to that exact category.

Let’s see how we can set a widget which will only be visible to certain WooCommerce product category:

  1. Download and install Widget Logic
  2. Now, Go to Appearance -> Widgets and add the widgets to your sidebar
  3. You’ll find a new “Widget Logic” field added at the bottom of every widget
  4. Go to Product -> Categories
  5. Select the category and copy what’s written on the Slug field
  6. Since you want to display these widgets only on WooCommerce category pages, write is_product_category() in widget logic field
  7. Paste the category slug, if you want to display widgets only on one category. Like this is_product_category( ‘clothing’ )
  8. Click on Save

Using Widget Logic along with WordPress and WooCommerce Conditional tags you can set various conditions and dictate when you want to display your widgets.

You may also like