Limit # of Products by Membership Level woocommerce

I’m using wc-vendors to allow users to sell on a wordpress woocommerce site.

I would like to limit the number of products a vendor can have listed based on membership level.

1 membership = 20 products

Is it possible to limit the # of products by the number or type of membership?

I found this code to limit products. Need to add ability to limit by membership level.

use that code, paste it in functions.php

add_action( 'admin_head-post-new.php', 'woo_limit_products_creation' );

function woo_limit_products_creation() {

global $post_type;
global $wpdb;

$products_limit = 50; // Change this value

if( $post_type === 'product' ) {
    $products_count = $wpdb->get_var( "SELECT count(*) FROM $wpdb->posts           WHERE post_status = 'publish' AND post_type = 'product'" );
    if( $products_count >= $products_limit ) { 
        wp_die( sprintf( __("Error. You are not allowed to create more than %s products."), $products_limit) ); 

Membership plugin ->

Also membership is triggered but purchasing a specific product.

Read more here: Limit # of Products by Membership Level woocommerce

Leave a Reply

Your email address will not be published. Required fields are marked *