Home Forums WC Vendors Free Support Hide Products from Pending Vendor

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.


Thank you to all of our customers!


Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #29091


    I have subscription plans to be a vendor on my marketplace and I want to suspend the user (changing his role from vendor to pending vendor) AND hide his products from the store.

    The first part is done using woocommerce groups and groups, but the second one is not and when an user is suspended, his products are still available on the shop to buy.

    Right now, I can only hide specific categories from the shop, but I wonder if it is possible to hide products from a specific user role instead. This way, when a vendor is downgraded to a pending vendor state, his products will still exist in the backend for when he becomes a vendor again (pays the subscription), but meanwhile, will not be visible to the other users.

    Is there any easy fix for this?

    Thanks and best regards!

    PS: For hiding categories, I used this code on functions.php:

    add_action( ‘pre_get_posts’, ‘custom_pre_get_posts_query’ );

    function custom_pre_get_posts_query( $q ) {

    if ( ! $q->is_main_query() ) return;
    if ( ! $q->is_post_type_archive() ) return;

    if ( ! is_admin() && is_shop() ) {

    $q->set( ‘tax_query’, array(array(
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => array( ‘Membership’ ), // Don’t display products in the knives category on the shop page
    ‘operator’ => ‘NOT IN’


    remove_action( ‘pre_get_posts’, ‘custom_pre_get_posts_query’ );


    WC Vendors Support

    You would have to loop through all of your websites posts, then filter down to post type = product, post_author = UserID of the vendor, and from there, change the _visibility key to ‘hidden’. Then of course, change it to ‘visible’ once you re-activate the vendors account.


    Hi Ben,

    Thanks a lot for the reply. I ended up adding a query on the “wcs-user-functions.php” file from WooCommerce Subscriptions plugin where it changes the user role depending on the subscription state and it works fine!

    UPDATE wp_postmeta SET meta_value = ‘visible’ WHERE meta_value = ‘hidden’ AND post_id IN (SELECT ID FROM wp_posts WHERE post_type = ‘product’ AND post_author = ‘$user_id’);


    UPDATE wp_postmeta SET meta_value = ‘hidden’ WHERE meta_value = ‘visible’ AND post_id IN (SELECT ID FROM wp_posts WHERE post_type = ‘product’ AND post_author = ‘$user_id’);

    Craig Hanson

    thanks for pointing this out! I have the same issue on my site and have notified my developer hoping that your fix will do the same on my site.

    Thanks for posting this Joao!

    Bola Gadalla

    @BEN i know that was like from 2016 but i was wondering if you developed a code where i could add to my theme function to hide the vendor’s products from the product page that he posted once he unsubscribe to my paying membership to be a vendor and then show the products again once he comes back to be a vendor again. i read all kind of articles and the help forms on this site and am not good with coding so when i read what @JPKAPINHA i didn’t understand that well and where i should add that code, in what file, theme function? am really sorry about this i tried to learn it and i couldn’t but there was a form where i found a code where it works with paid membership pro where once a vendor subscribe he will be automatically placed as a vendor.

    this is the code:

    /* Members signing up for membership level #1 get “Vendor” role. Members signing up for membership level #2 get “Vendor” role. Members cancelling are given the customer role. Admin users are ignored. */

    function my_pmpro_after_change_membership_level($level_id, $user_id) { //get user object $wp_user_object = new WP_User($user_id);

    //ignore admins
    if(in_array(“administrator”, $wp_user_object->roles))

    if($level_id == 1)
    //New member of level #1. Give them Vendor role.

    elseif($level_id == 0)
    //Cancelling. Give them Subscriber role.
    } add_action(‘pmpro_after_change_membership_level’, ‘my_pmpro_after_change_membership_level’, 10, 2);

    so is there a code where i could add to this so once they unsubscribe and become a subscriber not a vendor it will hide their products until he subscribe to be a vendor again.

    i really need help with this and it will be a lot of help if you could help me with this, i been trying to find a solution for like 3 days now and i cant find any.

    please help. and thanks a lot for you time

    Bola Gadalla

    Am using these plugins by the way:

    woocommerce, wc vendor, paid memebership pro and buddypress


    @bola did you ever get this sorted?

    I am looking at moving to a membership site and saw the paid membership pro and seems like it has the subscription built in which would make this a way cheaper option than woocommrce members, groups, subscriptions.

    Need to be sure that it will work with the role changes though and it would hide the products once the membership lapsed.

    Cheers in advance

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.
This website uses cookies to ensure you get the best experience on our website.