Home / Admin / Add Custom Taxonomy – Multiple Vendor Taxonomy
Duplicate Snippet

Embed Snippet on Your Site

Add Custom Taxonomy – Multiple Vendor Taxonomy

Allows the vendor to select multiple taxonomies

Code Preview
php
<?php
/**
 * Add the custom taxonomy to the WC Vendors Pro dashboard. 
 *
 */
function wcv_add_brands_field( $object_id ){ 
	WCVendors_Pro_Form_helper::select2( 
        array(
            'post_id'			=> $object_id,
            'id'				  => '_wcv_custom_taxonomy_wcv_brands[]',
            'class'				=> 'select2',
            'custom_tax'  => true, 
            'label'				=> __( 'Brand', 'wcvendors-pro' ),
            'taxonomy'		=>	'wcv_brands', 
            'taxonomy_args'		=> array( 
                    'hide_empty'	=> 0, 
            ),
            'custom_attributes'	=> array( 
			    'multiple' => 'multiple' 
		    ),
		)
	);
}
// Hook into the form after product tags to display the field 
add_action( 'wcv_after_product_details', 'wcv_add_brands_field' );

Comments

Add a Comment