Search Index the Product Category Archive page
-
Hi,
I am using Woocommerce to show products for cars and they all are marked with one or more product categories in the form of car brands. No product is marked with the parent product category (bilmarke) but are tagged with child product categories (like Ford, Volvo, Nissan etc). I have one product category pages (archive page) for each brand with the brand logo and text about what kind of products for this particular brand we are selling (and then then the products themselves).I would really like to include the Product Category archive page for e.g. Ford. But when I search for ‘Ford’ only the products and pages that contain ‘Ford’ is shown – not the Ford product category archive.
I found this snippet in the docs, and tried to adapt it to my particulars. But still no luck.
add_filter( 'relevanssi_modify_wp_query', 'rlv_include_product_cat' ); function rlv_include_product_cat( $query ) { if ( isset( $query->query_vars['product_cat'] ) ) { $query->query_vars['tax_query'][] = array( 'taxonomy' => 'product_cat', 'field' => 'bilmarke', 'terms' => $query->query_vars['product_cat'], 'include_children' => true, ); } return $query; }
All the best
M
- The topic ‘Search Index the Product Category Archive page’ is closed to new replies.