Change the sold by label on the product archive

// Unhook WC Vendors method remove_action( ‘woocommerce_after_shop_loop_item’, array(‘WCV_Vendor_Shop’, ‘template_loop_sold_by’), 9 ); // Define new sold by method function wcv_new_template_loop_sold_by( $product_id ) { $vendor_id = WCV_Vendors::get_vendor_from_product( $product_id ); // Get the products categories. $categories = get_the_terms( $product_id, ‘product_cat’ ); // Reset…Continue reading

Disable sold by link on checkout page

/** * Disable the sold by link on the checkout page */ add_filter(‘wcvendors_sold_by_link’, ‘wcv_disable_checkout_sold_by_link’, 10, 2); function wcv_disable_checkout_sold_by_link( $sold_by, $vendor_id ){ if ( is_checkout() ) { $sold_by = WCV_Vendors::get_vendor_sold_by( $vendor_id ); } return $sold_by; }Continue reading

Add custom page to the vendor dashboard – custom menu link

add_filter( ‘wcv_pro_dashboard_urls’, ‘custom_menu_link’ ); function custom_menu_link( $pages ) { $pages[ ‘custom_link’ ] = array( ‘slug’ => ‘http://yoursite.com/customlink/here’, ‘label’ => __(‘Custom Link’, ‘wcvendors-pro’ ), ‘actions’ => array() ); return $pages; }Continue reading

Add custom page to the vendor dashboard

// Hook into the navigation add_filter( ‘wcv_pro_dashboard_urls’, ‘add_test_page_nav’, 9 ); function add_test_page_nav( $pages ){ $pages[ ‘test_page’ ] = array( ‘slug’ => ‘test_page’, ‘id’ => ‘test_page’, ‘label’ => __( ‘Test Page’, ‘wcvendors-pro’ ), ‘actions’ => array( ‘edit’ => __( ‘New’, ‘wcvendors-pro’…Continue reading

Resetting the Vendor & Pending Vendor Roles

add_filter(‘woocommerce_login_redirect’, ‘redo_roles’, 10, 2); function redo_roles() { remove_role( ‘pending_vendor’ ); add_role( ‘pending_vendor’, __( ‘Pending Vendor’, ‘wcvendors’ ), array( ‘read’ => true, ‘edit_posts’ => false, ‘delete_posts’ => false ) ); remove_role( ‘vendor’ ); add_role( ‘vendor’, ‘Vendor’, array( ‘assign_product_terms’ => true, ‘edit_products’…Continue reading

Override the commission calculation priority order

/** * Given the provided list of vendor_ids in the vendors array, override the commission to use the vendor store commission. * Requires: WC Vendors Pro 1.8.6 or above. */ add_filter( ‘wcvendors_commission_args’, ‘wcv_store_vendor_override’, 10, 4 ); function wcv_store_vendor_override( $commission_args, $product_id,…Continue reading

Make All Users Vendors

/** * Make all new user registrations Vendors. */ add_filter( ‘woocommerce_new_customer_data’, ‘wcv_woocommerce_new_user_data’ ); function wcv_woocommerce_new_user_data( $data ){ $data[‘role’] = ‘vendor’; // the new default role return $data; } /** * Redirect the new registered user to the Vendor Dashboard */…Continue reading