Home Forums WoodMart support forum Hidden products and pages visible in search results

Hidden products and pages visible in search results

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #631642

    sytura
    Participant

    Hi there,
    I use

    1. hidden products which shouldn’t be visible in the shop (that’s working) and search results
    2. hidden pages which content is only accessible for members (memberships plugin) and shouldn’d be visible in search results.

    In the header I have integrated a search form with “search with ajax” option activated. When I use this form, hidden products AND hidden pages are visible in the search results.
    After form submit or after deactivating ajax, hidden pages aren’t shown anymore (correct), but hidden products are still visible.

    I temporarily deactivated ajax search. May you please check this functionality and tell me how I can solve these problems?

    Thank’s for your help and kind regards,
    Kerstin

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Sorry to hear about the inconvenience. Kindly, please share your Site WP-ADMIN Login details in the Private Content field so that we can check this concern on your Site and help you out accordingly.

    Best Regards

    #631957

    sytura
    Participant

    Hello,
    thank you. Below the admin credentials to our staging site

    Best regards,
    Kerstin

    #632102

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please check how it works with the default WordPress theme and Woocommerce Storefront theme just to check whether the issue is with our theme or not. Also, please check the site with our theme but only with the theme default plugins activate, and deactivate all the 3rd party plugins from the site.

    If it works fine with the default WordPress theme then let me know, I will further check on your site and give you a possible solution.

    Best Regards

    #632179

    sytura
    Participant

    Hello,
    I switched the theme to twenty-four and twenty-five. Please find the search result attached. I work with “search exclude” which works very well with standard search, but not with ajax search. To compare the search results, I also attached a screenshot of the ajax search results.

    To Sum up, Ajax search is the problem:

    1. products that should’t be listed is search results are set to “hidden” in the visability section AND additionally set to hidden in “search exclude” section. Only hidden via visablity alone doesn’t work correctly. With both hidden flags, these products aren’t listed in standard search, but in ajax search they show up
    2. pages that should’t be listed is search results are set to hidden via “search exclude” which works fine with standard seach, but not with ajax search

    Best regards,
    Kerstin

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Try to set the “Products” post type for the search – https://take.ms/uyJMm and then recheck the issue.

    Let me know the result.

    Best Regards

    #632273

    sytura
    Participant

    only products with ajax enabled: ok

    only pages with ajax enabled: hidden pages are shown. after “show all”, then pages AND products appear in the search results. See screenshots attached

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    I have hidden your product, “TERRADIX® Broadfork 4×250, Breitgrabegabel mit 4 Zinken,” from the search results. I then tested the search functionality using the keyword “TERRADIX,” and the product no longer appears in the search results.https://ibb.co/W2n91WZ

    Please check back your site and check the issue.

    Best Regards

    #633100

    sytura
    Participant

    Yes, it works because the ajax search in the header was restriced to products only. As soon as the post type is set to “all post types”, the hidden terradix product is shown in search results. see screenshots attached

    Best regards,
    Kerstin

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    The issue occurs because when the post type is set to “All Post Types,” the search functionality retrieves all content types, including hidden products. Unfortunately, the hidden products may still appear in the results unless specifically excluded from the query. You need to set the “Products” post type for the search – https://take.ms/uyJMm then products will work. This is the way it works.

    Best Regards

    #633392

    sytura
    Participant

    The standard search without ajax works correctly and doesn’t show hidden products or pages in the search results, see screenshot. Only with ajax and “all post types” these false results show up.

    For the ajax search is a woodmart function, I would like to ask you to fix this error or send me a snippet to correct the query in child theme.

    Thank you and best regards

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please add the below code in the child theme’s functions.php file:

    add_filter( 'woodmart_ajax_search_args', function ( $args, $post_type ) {
    	$args['tax_query'][] = array(
    		'taxonomy' => 'product_visibility',
    		'field'    => 'name',
    		'terms'    => ['exclude-from-catalog', 'exclude-from-search'],
    		'operator' => 'NOT IN',
    	);
    
    	return $args;
    }, 10, 2 );

    Best Regards.

    #635118

    sytura
    Participant

    Thank you! Hidden products are now hidden in ajax search results 🙂
    Hidden pages are still shown, see screenshot. Would you please add this part to the snippet?
    Thank you and best regards

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

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    In our theme, as well as in WordPress and WooCommerce, there is no built-in functionality called “Hidden pages”. It appears to be a feature provided by a third-party plugin, and unfortunately, we cannot fix this on our end. We recommend reaching out to the support team of the plugin or functionality you are using for further assistance.

    Best regards,

    #635245

    sytura
    Participant

    Hello,
    ah, I see. You’re right, that functionality comes from “search exclude” plugin. So, thank you for the snippet, hidden products now are also hidden in ajax rearch results
    Best regards,
    Kerstin

    #635303

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    You’re welcome! I’m glad the snippet helped in hiding the products from the AJAX search results. If you need any further assistance, feel free to ask.

    Have a nice day.

    Best Regards

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