How can I display only the parent category in the filter on the left side of the shop interface?

This topic has 8 replies, 3 voices, and was last updated 7 months, 3 weeks ago ago by Luca Rossi

  • Avatar: Jet
    Jet
    Participant
    April 29, 2024 at 03:14

    My shop interface now only displays subcategories, not main categories. How should I make the shop interface only display the subject category?

    Files is visible for topic creator and
    support staff only.
    7 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    April 29, 2024 at 06:55

    Hello, Jet,

    Thank you for reaching out to us with your query.

    Could you please provide temporary wp-admin access? We need to check your current settings first.

    To grant WP-Admin access, please proceed to create a new user account with an administrator role through your WordPress Dashboard. Once the account is established, you may securely transmit the username and password to us via the Private Content section designated for this purpose.

    Best Regards,
    8Theme’s Team

    Avatar: Jet
    Jet
    Participant
    April 29, 2024 at 08:32

    Hello, I have filled it out. My requirement is that the left filter bar on the shop interface only displays the main categories. Thank you.

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 29, 2024 at 18:09

    Dear Jet,

    We hope this message finds you well. Unfortunately, there are no hooks available to customize the category filter widget directly through settings or options.

    To achieve the desired customization, you will need to modify a specific file within the plugin directory. Please follow the instructions below:

    1. Navigate to the file located at:
    /wp-content/plugins/et-core-plugin/app/models/widgets/categories-filter.php

    2. Locate the code between lines 124 and 129, which currently reads:

    
       $categories = get_terms(array(
           'taxonomy' => 'product_cat',
           'hide_empty' => $hide_empty,
           'operator' => 'IN',
           'include_children' => false,
       ));
    

    3. Replace the above code with the following:

    
       $categories = get_terms(array(
           'taxonomy' => 'product_cat',
           'hide_empty' => $hide_empty,
           'operator' => 'IN',
           'include_children' => false,
           'parent' => 0
       ));
    

    We hope these instructions are helpful to you. Should you require any further assistance, please do not hesitate to contact us.

    Best regards,
    The 8Theme Team

    Avatar: Jet
    Jet
    Participant
    April 30, 2024 at 02:16

    Hello, what should I do in the first step? I can’t find the editing interface.

    Avatar: Justin
    Luca Rossi
    Support staff
    April 30, 2024 at 04:20

    Hi @Jet,

    Are you using SiteGround? Please take a look at this article: https://www.siteground.com/kb/manage-files-file-manager/.

    Hope it helps!

    Avatar: Jet
    Jet
    Participant
    April 30, 2024 at 04:33

    Thanks, I tried it, but the category filter is gone. Is there any other way? The shop interface only shows the main category.

    Avatar: Justin
    Luca Rossi
    Support staff
    April 30, 2024 at 08:18

    Dear Jet,

    We hope this message finds you well. We would like to inform you that your main categories currently do not contain any products. As a result, they will not be displayed in the Product Categories Filter.

    To address this, please assign products to these main categories. Once this has been done, kindly proceed to edit the plugin file accordingly.

    Should you require any further assistance, please do not hesitate to contact us.

    Best Regards,
    The 8Theme Team

  • Viewing 8 results - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.