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.
Do you think this plugin is still safe to use? I see that it’s very lightweight, with only one file – and it does exactly what I am looking for to add a product filter to my woocommerce store for some of the product categories.
The alternatives are all very big plugins offering 95% functionality I don’t need.
What do you think? Would you still use it today, or do you know of any good alternatives?
Yes, still good! I guess for those who are still on Classic Editor this is perfectly fine. Not sure if it’s compatible with Gutenberg.
Hi.
Looks like Widget Logic doesn’t work on Widget blocks.
I’m sure they’re working on it, it’s a very popular plugin. For now, I’ve been using “Classic Widget” plugin honestly because I don’t like the new UX at all
Hi, is there a way to write this piece of code on functions? so that no need to install a plugin?
Hi Milad, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi
Widget Logic has not been updated in two years, there is no support.
Thanks for your feedback!