Add To My Store Catalog: Show Only Admin Products

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!

Viewing 3 reply threads
  • Author
    Posts
    • #117764
      VirtualVendor
      Participant

      Hi,

      the “Add To My Store” Catalog lists products created by the admin and other store managers. How can I hide products from other store managers and only show the ones created by the admin?

      In addition, I need to remove the “Add To My Store” Button on other vendor’s products.

      Is this possible?
      Thanks!

    • #118376
      WCFM Forum
      Keymaster

      Hi,

      Sure, please add this snippet to your site for the purpose-

      add_filter( 'wcfm_sell_items_catalog_args', function( $args ) {
      	if( isset( $args['author__not_in']  ) ) unset( $args['author__not_in']  );
      	$args['author'] = 1; 
      	return $args;
      }, 50 );
      add_filter( 'wcfmmp_is_allow_single_product_multivendor_by_product', function( $is_allow, $product_id ) {
      	global $WCFM, $WCFMmp, $product, $post;
      	
      	$product_author = wcfm_get_vendor_id_by_post( $product_id );
      	if( $product_author ) {
      		$is_allow = false;
      	}
      	return $is_allow;
      }, 50, 2 );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      Thank You

    • #118454
      VirtualVendor
      Participant

      This works perfectly! Thank you!

    • #145357

      Is it possible to allow products created by a certain User ID?

Viewing 3 reply threads
  • You must be logged in to reply to this topic.