• I use the Relevanssi plugin to search for Woocommerce products. How to do:
    1) Exclude all products from a certain category?
    2) Exclude products that are out of stock from the search results. Exclude variable products if there are none of the variations.

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

    (@msaari)

    1. Exclude in a single search, or exclude always? The relevanssi_indexing_restriction filter hook is the best method for permanently excluding a category from the results.

    2. To exclude out-of-stock products, use

    add_filter( 'relevanssi_woocommerce_indexing', 'rlv_woocommerce' );
    function rlv_woocommerce( $blocks ) {
      $blocks['outofstock'] = true;
      return $blocks;
    }

    I don’t have a ready solution for excluding parent products if variations aren’t in stock, but relevanssi_hits_filter can help with everything.

    Thread Starter MaTam

    (@matam)

    1. Exclude from the Relevanssi search. The category itself remains on the site and in Google search.
    2. Thank you!
    3. Is it possible to sort products by rating by sales popularity (total_sales indicator)?

    Plugin Author Mikko Saari

    (@msaari)

    1. Ok, in that case, relevanssi_indexing_restriction is the way to go, that will make sure the category won’t appear in the Relevanssi search, ever.

    3. Yes, the instructions are here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘search in Woocommerce’ is closed to new replies.