Home Forums Basel support forum Narrow the selectable categories for the search bar

Narrow the selectable categories for the search bar

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #85458

    Jeriss Cloud Center
    Participant

    When I make a search, I have the possibility to select a category on the right side. But it’s showing absolute all the categories. I don’t want this, I want to narrow it to the first or second levels maximum. How can I change this?

    Also, I wanna be able to change this value according to the category in which the user is. Is that possible?

    Attachments:
    You must be logged in to view attached files.
    #85473

    Artem Temos
    Keymaster

    Hi,

    Try to add the following PHP code snippet to the child theme functions.php file to do this. It will show only parent categories from the shop.

    add_filter('basel_show_only_parent_categories_dropdown', '__return_true');

    Regards

    #85678

    Jeriss Cloud Center
    Participant

    I have added your code and the result is that I have only 1 parent category (Cordonnerie) getting display in the dropdown altough I have 4 of them (Cordonnerie, Serrurerie, Horlogerie, Imprimerie). This is of course not the expected behavior. What I want is to show the 4 main categories just mentionned.

    Attachments:
    You must be logged in to view attached files.
    #85710

    Artem Temos
    Keymaster

    Hi,

    Please, add the code now so we can check how it works. Currently, it displays all the categories.

    Regards

    #85771

    Jeriss Cloud Center
    Participant

    I just activated the code. Please check again

    #85788

    Hello,

    The categories are empty that is they are not shown.

    Best Regards

    #85917

    Jeriss Cloud Center
    Participant

    Indeed. I just made a test by adding a product into the (currently) empty categories and your code is working fine.

    Issue completed.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Narrow the selectable categories for the search bar’ is closed to new replies.