admin管理员组

文章数量:1122832

I have been struggling with this and could not find a clear answer online.

Will putting a product search bar I have a dropdown visible with all the categories you can search in. I would just like to keep only the categories and remove the "all categories" option.

You can see the current search I would like to fix here :

Thank you to anyone who will be able to help :)

I have been struggling with this and could not find a clear answer online.

Will putting a product search bar I have a dropdown visible with all the categories you can search in. I would just like to keep only the categories and remove the "all categories" option.

You can see the current search I would like to fix here : https://compare-tech.fr

Thank you to anyone who will be able to help :)

Share Improve this question asked Jan 6, 2020 at 16:52 AntoineAntoine 113 bronze badges 2
  • Welcome Antoine! Please answer a question or two, so we might provide more accurate recommendations. 1. Did you code this search, or are you using a default Wordpress widget? 2. If you coded this, would you please provide a sample of your code, so we can advise you how to modify it. – Mike Baxter Commented Jan 6, 2020 at 17:53
  • Hello, Thank you for your answer. This is the default wordpress widget. – Antoine Commented Jan 6, 2020 at 18:23
Add a comment  | 

1 Answer 1

Reset to default 0

This list can be modified using WooCommerce filters. However, without a thorough testing I could not find a specific filter to help you. You might check the API for a better answer.

Meanwhile, I have used this CSS snippet to successfully hide the "All Categories" entry from the drop-down selector:

li.option[data-value=''] {
    display: none;
}

This will only prevent users from selecting "All Categories" again. It will not prevent your page from defaulting to "All Categories".

Hope this is helpful!

本文标签: searchRemove quotAll categoriesquot from searchbar dropdown