• Resolved Argentum

    (@argentum)


    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    You need Relevanssi Premium for this, the free version will only return posts tagged with the term. Relevanssi Premium can also return the tag archive pages.

    Thread Starter Argentum

    (@argentum)

    Ah, I see. I will havet to check with the client if SEK1,215.96 annual fee is acceptable. My guess is not. But thank you for the functionality that the free version provides.
    All the best
    M

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search Index the Product Category Archive page’ is closed to new replies.