Home Forums WoodMart support forum Product Categories Order in Header Search Dropdown

Product Categories Order in Header Search Dropdown

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #716571

    granule.petshop
    Participant

    Hello,
    I have a question regarding the product categories dropdown in the header search field.

    Currently, the categories in the dropdown are displayed in alphabetical order. However, I would like them to follow the default order defined in Products → Categories (i.e., the custom/manual order set in WooCommerce).

    I want the category “Psi” to appear first (along with its subcategories), as it is positioned in my category structure (Products -> Categories), instead of being sorted alphabetically where “Mačke” appears first.

    Is there a way to:
    * Display categories in the dropdown according to their custom order (menu order) instead of alphabetical order?
    * Or override this behavior via theme settings, hooks, or filters?

    If not available by default, is there a recommended workaround?

    Thank you in advance!

    Best regards,
    Dejan

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Option “show category” will show the categories menu generated automatically based on all existing categories in the shop. Sorry there is no option in theme settings to change the order. It requires customizations and this is beyond our limitations and support policy.

    You need to edit the theme files for this. All the customizations made in the theme files are at your own risk.

    inc/modules/search/class-ajax-search.php

    Best Regards

    #716654

    granule.petshop
    Participant

    Hello,

    Thank you for your previous reply.

    I would like to avoid modifying theme core files (such as class-ajax-search.php), as this is not update-safe.

    My goal is very specific:
    I need the product categories in the header search dropdown (category selector) to follow the order defined in WooCommerce → Products → Categories (custom order / menu order) instead of alphabetical order.

    Could you please clarify:

    1. Is there any filter or hook available to modify the categories query used in the header search dropdown?
    2. If not, is there a recommended child-theme-safe override for this specific functionality?
    3. Or is this currently not customizable without editing core theme files?

    I am only targeting the header search category dropdown, not global category ordering.

    Thank you in advance.

    Best regards,
    Dejan

    #716658

    granule.petshop
    Participant

    To clarify:
    I only want the order of all categories in the header search dropdown to match the order already defined in WooCommerce → Products → Categories (custom order / menu order), instead of alphabetical order.

    So I am not asking for a custom manual sorting solution just for the header.
    I only want the dropdown to inherit the existing WooCommerce category order.

    If there is a filter, hook, or child-theme-safe way to make the header search category dropdown respect that existing category order, please let me know.

    Thank you.

    #716698

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Unfortunately, it is not possible. Such modification requires complicated WooCommerce code customization, which is not covered by our support.

    If you want to edit the theme file directly, then you need to copy the inc/modules/search/class-ajax-search.php file from the main theme to the child theme and then try to customize it.

    Best Regards

    #716720

    granule.petshop
    Participant

    Hello,

    I think there may be a misunderstanding, so I would like to clarify.

    I am not referring to AJAX search suggestions or category suggestions while typing in the search field.

    I am referring only to the static category selector dropdown in the header search form – the dropdown attached to the “All categories” (SVE KATEGORIJE) field.

    So the issue is only this part:

    * the static dropdown that lists all product categories in the header search form
    * not the live search suggestions

    I would like this static header search category dropdown to follow the existing WooCommerce category order from:

    WooCommerce → Products → Categories

    instead of alphabetical order.

    Could you please confirm whether the file/method responsible for this static dropdown is really inc/modules/search/class-ajax-search.php, or if it is located elsewhere?

    I attached a screenshot and marked the exact dropdown I mean.

    Thank you.

    Best regards,
    Dejan

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please try to use the Simple custom post order plugin and then manage the product categories order from Product >> Categories section, then it will show the same order on the frontend in the categories dropdown.

    https://wordpress.org/plugins/simple-custom-post-order/

    Best Regards.

    #716788

    granule.petshop
    Participant

    Hello,

    Thank you for your suggestion.

    I tried using the Simple Custom Post Order plugin as recommended, but unfortunately it caused serious issues:

    * After reordering product categories, products disappeared from main shop page (https://granule.rs/prodavnica/)
    * The plugin does not properly handle hierarchical structures (subcategories are not preserved when reordering parent categories)
    * Overall, it breaks the existing WooCommerce category structure and display logic

    Because of this, it is not a viable solution in my case.

    Also, I would like to clarify something important:

    WooCommerce already provides a native drag & drop (menu order) functionality for product categories under:
    Products → Categories

    My expectation is simply that the header search category dropdown respects this existing WooCommerce category order.

    At the moment, it seems that WoodMart ignores the default WooCommerce category ordering and forces alphabetical sorting instead.

    So my question is:

    👉 Why is the theme not using the native WooCommerce category order (menu_order) for this dropdown?
    👉 Is there any way to make the header search category selector follow the default WooCommerce ordering without using third-party plugins or modifying core theme files?

    I am only trying to use the built-in WooCommerce functionality, not introduce a new ordering system.

    Thank you in advance for your clarification.

    Best regards,
    Dejan

    #716848

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    At the moment, we don’t have functionality that allows changing the order of items in the dropdown search form. However, we can offer you an alternative solution to achieve the desired result.

    You can add the following CSS code to the theme settings, and in this case, the “Psi” category will appear first:

    .wd-dropdown-search-cat .wd-sub-menu {
        display: flex;
        flex-direction: column;
    }
    .wd-dropdown-search-cat .cat-item-48 {
        order: -1;
    }

    Best Regards.

    #716849

    granule.petshop
    Participant

    Perfect, this works 🙂
    Thank you very much!

    #716857

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    You’re Most Welcome!

    Feel free to write back anytime. If you need further assistance, we are always here to help you.

    If you have a minute, we’d truly appreciate your feedback — it helps us improve the product and shape future updates more effectively. We’d love your feedback on our theme: https://tally.so/r/w4l54k

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards.

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

The topic ‘Product Categories Order in Header Search Dropdown’ is closed to new replies.