WooCommerce Product Vendors: Display Vendor Details

WooCommerce Product Vendors is an awesome extension that adds to WooCommerce many features to help you create a whole marketplace like any Envato marketplaces (CodeCanyon, ThemeForest, GraphicRiver etc…), or Creative Market.

I have to admit I love that extension built by Hugh, one of my awesome fellows at WooThemes.

Today I’d like to share a little snippet that allows you to display vendors details within the “vendor” tab on the product page. By default the tab content is populated by vendor’s fields, but you can add more. For example to display the commission value use the following code:

<?php

add_action( 'product_vendors_tab_content_after' , 'display_vendor_fields', 2, 10 );

/**
 * display_vendor_fields
 *
 * @access      public
 * @since       1.0
 * @return      void
*/
function display_vendor_fields( $vendor_ID, $product_ID ) {

	$vendor     = get_vendor( $vendor_ID );
	$commission = $vendor->commission;

	echo 'Commission: ' . $commission . '%';

}

Pretty easy right?

The final result:

product-vendors-fields