Archived topic
Categories and subcategories
10 replies · Started by Jose on May 9, 2020
Hi,
Finally I have added the default category filter to my shop. The problem is that it shows at the same level categories and subcategories, how can I changue that?
May be subcategories as detachable or something like that.
Regards,
Hi there,
Not sure if I fully understand.
Are you talking about the items in the sidebar?
If so maybe something like this?
.sidebar .widget ul li.cat-item:not(.cat-parent) {
padding-left: 20px;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
more or less, but not entirely. Now it also gives me margin to those products that do not have a subcategory. I want Category 1 to be on the left, and then Category 2 to have that margin.
I understand that adding a kind of drop down button is very complicated, right?
I want Category 1 to be on the left, and then Category 2 to have that margin.
Not sure if I fully understand. Can you show a screenshot of what you have in mind?
You can use a service like this and provide the direct links here:
https://postimages.org/
Drop down arrow would require some custom coding for sure.
Maybe try to find a WooCommerce product filter plugin?
Ok, I don't need the arrow, I only need that the subcategories have the left margin, to understand that they are subcategories.
I mean:
Category
Category
Subcategorie
Subcategorie
Category
Didn't my CSS above do that already?
This is what I'm seeing:
https://www.screencast.com/t/XG63DHuS
From the code, it looks like the indented items are sub categories.
The problem is that only the categories with subcategories are in the lef side. I mean, the first one, "Cursos" is a category without subcategories and it is moved.
Try this instead:
.sidebar .widget ul li ul.children li {
padding-left: 20px;
}
It works!
Regards,
Glad to hear :)