Search and display product content created via custom tabs plugin.
Custom Product Tabs for WooCommerce plugin allows shop owners to create product tabs with any custom content inside.
Advanced Woo Search plugin has built-in integration with these custom tabs content and this allows you to search for any product via this content or event display that content for each product inside search results.
Search for products via content inside custom tabs.
You don't need to apply any extra steps here. Just search for any words/phrases that are inside your custom tabs.
Another great news here is that tabs content synchronizes with search plugin automatically. This means that when you change content for any tab these changes will immediately reflect on plugin search results output.
Customize your products search results output and include custom tabs content inside it.
Advanced Woo Search plugin has many built-in hooks that you can use to customize search results.
In this section we will provide code snippet example for displaying some tab content for products.
For example, we have two product tabs: Custom tab 1
and Custom tab 2
.
And inside the search results output we want to show the second tab title and content as product description. In this case we can use following code snippet:
add_filter( 'aws_excerpt_search_result', 'aws_excerpt_search_result', 10, 3 ); function aws_excerpt_search_result( $excerpt, $post_id, $product ) { if ( $custom_tabs = get_post_meta( $post_id, 'yikes_woo_products_tabs' ) ) { if ( $custom_tabs && ! empty( $custom_tabs ) ) { foreach( $custom_tabs as $custom_tab_array ) { if ( is_array( $custom_tab_array ) && ! empty( $custom_tab_array ) ) { foreach( $custom_tab_array as $key => $custom_tab ) { if ( $key === 1 ) { $excerpt = $custom_tab['title'] . '<br>' . $custom_tab['content']; } } } } } } return $excerpt; }
Now the product description must contain custom tab data inside.