Search products by attribute using etheme_ajax_search_products_query

This topic has 2 replies, 2 voices, and was last updated 2 months ago ago by Jack Richardson

  • Avatar: emin
    emin
    Participant
    September 16, 2024 at 14:14

    Hello,

    I’m trying to include product attribute in the search query but with no luck.

    I placed this code in functions.php:

    add_filter('etheme_ajax_search_products_query', function ($args) {
    
        $term = get_term_by('name', $args['s'], 'pa_brand-identifier');
    
        $brand_id_args = array(
            'taxonomy' => 'pa_brand-identifier',
            'operator' => 'IN',
        );
    
        if ($term) {
            $brand_id_args['terms'] = array($term->term_id);
            array_push($args['tax_query'], $brand_id_args);
            $args['tax_query']['relation'] = 'OR';
        }
    
        return $args;
    });

    Note: I tried with the slug field as well.

    Am I doing something wrong?

    Regards

    1 Answer
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    September 16, 2024 at 15:14

    Dear @emin,

    Thank you for reaching out to us.

    Unfortunately, the feature you are requesting is not available by default and would require specific customization codes to be implemented.

    Should you require personalized customization services, we kindly invite you to submit a request through our customization panel at the following link: https://www.8theme.com/account/#etheme_customization_panel. This will enable direct engagement with our technical team.

    Please be advised that customization services incur additional charges. The exact cost will be determined after a detailed review of your request.

    OR Please post your request on our Taskboard at https://www.8theme.com/taskboard/ -If it receives enough votes from other customers, our development team will consider adding it in one of the upcoming updates.

    Additionally, You can try to use third-party search plugins that include the desired functionality.
    We don’t give a guarantee for full theme compatibility with all 3-rd party plugins.

    Thank you for your understanding.

    Best regards,
    Jack Richardson
    The 8Theme Team.

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

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

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