Issues with the xstore search products form

This topic has 15 replies, 2 voices, and was last updated 20 hours, 2 minutes ago ago by mitys

  • Avatar: mitys
    mitys
    Participant
    February 16, 2026 at 19:37

    Hello,
    We are facing some issues related to the results of the xstore search products form.

    1* When we search with a variation SKU (with one letter missing for ex.)(search variations option enabled), the product is displayed more than once (one per variation that has an SKU that would match with our search term)(The results are not easily distinguishable since we have the same product title repeated x times).

    2* With WPML activated in our website, when we search with the term “itouch” for example, we get results displayed in both languages: french and english when they are supposed to follow the user selected language.

    3* When we disable the search variations option, we are no longer enable to get the parent product displayed in the search results (while searching with the variation SKU for example).

    Thanks for your help

    Content is visible for topic creator and
    support staff only.
    14 Answers
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 17, 2026 at 09:36

    Hello, mitys,

    We have noticed that your website is utilizing a large number of plugins. This could potentially impact the website’s performance, lead to errors, and affect its overall speed. To ensure optimal functionality and avoid such issues, we kindly ask you to manually review each plugin currently in use on your website.

    If the problem persists, we suggest switching to the Parent theme if you are currently using the Child Theme on your site. After clearing the cache, check again.
    Do the same test for the default WooCommerce theme – Storefront. The issue may be due to your custom code in the Child Theme.

    Let us know the results.

    Best regards,
    8Theme’s Team

    Avatar: mitys
    mitys
    Participant
    February 18, 2026 at 17:49

    Hello,
    Can you tell me please how did you proceed to disable the inclusion of variations in the search results ?
    Thank you.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 19, 2026 at 11:27

    Hello,

    In this case, the SKU of the parent product should be similar to the SKU of its variations.

    For example, if the parent product has the SKU test-12-12, then the variations should have SKUs such as test-12-12-1, test-12-12-2, and so on.

    Best regards,
    8Theme Team

    Avatar: mitys
    mitys
    Participant
    February 19, 2026 at 20:17

    Hello, okay, get the point.
    However, my question was more related to the screenshot that you’ve sent. Because I’d like to enable the variations search and test it with an other theme / other plugins disabled…
    Thank you.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 20, 2026 at 08:42

    Hello, mitys,

    Our search by variations is available only for the XStore theme.
    Best regards,
    The 8Theme Team

    Avatar: mitys
    mitys
    Participant
    February 20, 2026 at 20:55

    Sorry, I meant the parent theme instead of the child theme.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 23, 2026 at 08:03

    Hello, mitys,
    The search by variations is also available in the parent theme too
    Best regards,
    8Theme Team

    Avatar: mitys
    mitys
    Participant
    February 23, 2026 at 22:39

    They are currently disabled, how can I enable them ?

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 24, 2026 at 10:18

    Hello, mitys,
    we were looking for variations. To do this yourself, you need to open the header in the Elementor editor mode, go to the Ajax search element, and in the data type field, select the product variation as shown in the screenshot attached to the post.

    Best Regards,
    8Theme’s Team

    Files is visible for topic creator and
    support staff only.
    Avatar: mitys
    mitys
    Participant
    February 24, 2026 at 21:11

    Hello, I’ve tried that but it didn’t work, you’ve sent to us this screenshot in the past: https://prnt.sc/xzMlvyAB0fnH
    But I cannot find where it is located..

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 25, 2026 at 08:58

    Hello, mitys,

    We have enabled this option for you and are also providing a video showing where to find it in the future.

    Best regards,
    The 8Theme Team

    Files is visible for topic creator and
    support staff only.
    Avatar: mitys
    mitys
    Participant
    February 25, 2026 at 21:45

    Hello, thank you for the demonstrating video.
    I’ve finally succeded to include the search variations again in the staging site. However, I disabled the other than woocommerce and WPML plugins and I also switched from the child theme to the parent them, and I still get search results in both languages despite the fact that I’ve already selected the ‘En’ Language (search by UGS: V50-0202QH).

    Content is visible for topic creator and
    support staff only.
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 26, 2026 at 09:31

    Hello, mitys,

    to fix this issue you have added the following custom code to your child theme. Please check if the issue persists.

    /**
     * Ensure product search by SKU respects selected language in XStore et_search requests.
     */
    add_filter( 'posts_where', 'xstore_child_limit_product_search_by_lang', 999, 2 );
    function xstore_child_limit_product_search_by_lang( $where, $query ) {
        if ( is_admin() || ! ( $query instanceof WP_Query ) ) {
            return $where;
        }
    
        if ( empty( $_GET['et_search'] ) || ! $query->is_search() ) {
            return $where;
        }
    
        $post_type = $query->get( 'post_type' );
        $is_product_query = ( 'product' === $post_type ) || ( is_array( $post_type ) && in_array( 'product', $post_type, true ) );
        if ( ! $is_product_query ) {
            return $where;
        }
    
        $lang = $query->get( 'lang' );
        if ( empty( $lang ) && isset( $_GET['lang'] ) ) {
            $lang = wp_unslash( $_GET['lang'] );
        }
    
        $lang = is_string( $lang ) ? preg_replace( '/[^a-zA-Z_-]/', '', $lang ) : '';
        if ( '' === $lang ) {
            return $where;
        }
    
        global $wpdb;
    
        // WPML: limit products to requested language.
        if ( defined( 'ICL_SITEPRESS_VERSION' ) || defined( 'ICL_LANGUAGE_CODE' ) ) {
            $icl_table = $wpdb->prefix . 'icl_translations';
            $condition = $wpdb->prepare(
                " AND EXISTS (
                    SELECT 1 FROM {$icl_table} icl
                    WHERE icl.element_id = {$wpdb->posts}.ID
                    AND icl.element_type = 'post_product'
                    AND icl.language_code = %s
                )",
                $lang
            );
    
            return $where . $condition;
        }
    
        // Polylang: limit products by language taxonomy relation.
        if ( defined( 'POLYLANG_VERSION' ) || function_exists( 'pll_current_language' ) ) {
            $condition = $wpdb->prepare(
                " AND EXISTS (
                    SELECT 1
                    FROM {$wpdb->term_relationships} tr
                    INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
                    INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id
                    WHERE tr.object_id = {$wpdb->posts}.ID
                    AND tt.taxonomy = 'language'
                    AND t.slug = %s
                )",
                $lang
            );
    
            return $where . $condition;
        }
    
        return $where;
    }

    Best Regards,
    8Theme’s Team

    Avatar: mitys
    mitys
    Participant
    February 27, 2026 at 21:01

    Hello, I’ve implemented this code and the variations are no longer displayed in the search results with it…

    Content is visible for topic creator and
    support staff only.
  • Viewing 15 results - 1 through 15 (of 15 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.