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