Claim your freedom to choose the perfect partner for your multi-vendor journey.

FREEDOM25

Celebrate the festive season by giving your marketplace a powerful lift!

FESTIVE20

5.0.0
Something big is coming for marketplace admins… MultiVendorX 5.0 is almost here. Are you ready?
Be the first to explore all the game-changing features!
Power your marketplace dreams with unbeatable Black Friday deals!

MVXBLACK30

Supercharge your marketplace vision with unstoppable Cyber Monday deals!

MVXCYBER30

Holiday cheer, bigger savings
Take 25% off-because your marketplace deserves a gift too.

happyholiday

View Categories

Specific Category wise Vendor List

Suppose you want to show vendors of a “hoodies” category only.

Use this code in your currently active theme functions.php file.

/**** Add category attribute on vendor list shortcode *****/
add_filter('mvx_vendor_list_get_mvx_vendors_args', 'mvx_vendor_list_shortcode_category_attribute' , 10 , 4 );
function mvx_vendor_list_shortcode_category_attribute( $query, $order_by, $qst, $atts ){
   if( empty( $atts ) ) return $query;
   $block_vendors = wp_list_pluck(mvx_get_all_blocked_vendors(), 'id');
   $include_vendors = array();
   $pro_args = array(
      'posts_per_page' => -1,
      'post_type' => 'product',
      'tax_query' => array(
         array(
            'taxonomy' => 'product_cat',
            'terms' => array_map('sanitize_title', explode(',',$atts['category'])),
            'field' => 'slug',
            'operator' => 'IN'
            )
         )
      );
   $products = get_posts($pro_args);
   $product_ids = wp_list_pluck($products, 'ID');
   foreach ($product_ids as $product_id) {
      $vendor = get_mvx_product_vendors($product_id);
      if ($vendor && !in_array($vendor->id, $block_vendors)) {
         $include_vendors[] = $vendor->id;
      }
   }
   $query['include'] = $include_vendors;
   return $query;
}

Then define the “category” attribute with vendor list shortcode : 
[mvx_vendorslist orderby=”category” order=”ASC” category="hoodies"]

Leave a Reply

Shopping Cart
Scroll to Top