Tagged: ausblenden, Produkte, woocommerce
-
AuthorPosts
-
October 30, 2025 at 6:56 pm #1490772
Hallo Zusammen, bei Woocommerce kann man ja einstellen, wo ein Produkt gezeigt werden soll.
Im Shop und den Suchergebnissen, Nur im Shop, nur Suchergebnisse oder ausgblendet.
Leider funktioniert das nicht für die Enfold Suche und bei Ähnlichen Produkten wird es auch angezeigt, wenn man es zb auf ausgeblendet setzt. Ich habe es jetzt mit CSS gelöst, aber vielleicht könnte man das ja mit einem Update in Zukunft mal besser lösen?Danke und Gruß KiM
October 31, 2025 at 6:37 am #1490787Hey Blatze,
Thank you for the inquiry.
Try to add this code in the functions.php file to adjust the search query for products:
function ava_pre_get_posts_mod( $query ) { if ( ! is_admin() && $query->is_search() && $query->is_main_query() ) { if ( class_exists( 'WooCommerce' ) && ( $query->get( 'post_type' ) === 'product' || isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' ) ) { $meta_query = (array) $query->get( 'meta_query' ); $meta_query[] = array( 'key' => 'catalog_visibility', 'value' => array( 'hidden', 'exclude-from-search' ), 'compare' => 'NOT IN' ); $query->set( 'meta_query', $meta_query ); } } } add_action( 'pre_get_posts', 'ava_pre_get_posts_mod', 20 );Let us know the result.
Best regards,
IsmaelOctober 31, 2025 at 4:43 pm #1490819Hi Ismael,
danke für die schnelle Hilfe, falls dies das ausgeblendete Produkt auch bei ähnliche Produkte und in der Enfold Suche ausblenden sollte, dann funktioniert der Code nicht. Habe es gerade mit einem Produkt getestet und es wird bei beidem noch angezeigt.
DankeHi Ismael,
Thanks for your quick help. If this is supposed to hide the hidden product from similar products and the Enfold search, then the code isn’t working. I just tested it with a product and it’s still showing up in both places.
ThanksNovember 3, 2025 at 1:20 pm #1490887Hi,
Thank you for the inquiry.
The code is supposed to fix the hidden product issue on the search page. If this is not working, we may need to view and access the site to check the issue further. Please provide examples of the hidden products that are not supposed to display on the search page, then include the login details in the private field.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.
