How do I set a vendors products to NOT show up anywhere but in the vendors store

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Ultimate How do I set a vendors products to NOT show up anywhere but in the vendors store

Viewing 1 reply thread
  • Author
    Posts
    • #63847

      I want to exclude one of my vendors products from being searched by the sitewide product search. You provided a way to exclude vendor(s) from showing up on the “store list page” using the exclude parameter for wfcm_stores. I want to do the same thing with their products. I do not want their products visible anywhere, but at their store URL. I have spent several hours searching with no success.

    • #64195
      WCFM Forum
      Keymaster

      HI,

      Already provided solution over email.

      This code snippet require –

      add_action( 'woocommerce_product_query', function( $query, $that ) {
      	$wcfm_store_url = get_option( 'wcfm_store_url', 'store' );
      	$store_name = urldecode( get_query_var( $wcfm_store_url ) );
      	if ( !is_admin() && $query->is_main_query() && empty( $store_name ) ) {
      		$query->set( 'author__not_in', array(2) ); // Replace 2 with your Vendor ID
      	}
      }, 20, 2 );

      Thank You

Viewing 1 reply thread
  • You must be logged in to reply to this topic.