Add a custom column to Commission table

/** * Add custom columns label * * @param Array $columns array stored column names * @return Array $columns */ function custom_commissions_columns( $columns ) { $columns[‘id’] = __( ‘ID’, ‘wc-vendors’ ); return $columns; } add_filter( ‘wcvendors_commissions_columns’, ‘custom_commissions_columns’, 10, 1 );…Continue reading

Commissions as a fixed dollar amount, or fixed plus a percentage.

add_filter( ‘wcv_commission_rate’, ‘my_wcv_custom_filter’, 10, 3 ); function my_wcv_custom_filter( $commission, $product_id, $product_price ) { return WCV_Commission::get_commission_rate( $product_id ); } add_filter( ‘wcv_commission_rate’, ‘my_wcv_commission_rate’, 10, 4 ); function my_wcv_commission_rate( $commission, $product_id, $product_price, $order ) { $per_item_addition = .3; //add $0.30 charge for each…Continue reading

Redirecting Vendors to Vendor Dashboard on Login

add_filter(‘woocommerce_login_redirect’, ‘login_redirect’, 10, 2); function login_redirect( $redirect_to, $user ) { // WCV dashboard — Uncomment the 3 lines below if using WC Vendors Free instead of WC Vendors Pro if (class_exists(‘WCV_Vendors’) && WCV_Vendors::is_vendor( $user->;ID ) ) { $redirect_to = get_permalink(…Continue reading

Single Vendor Purchase

// Limit checkout to a single vendor store add_action( ‘woocommerce_add_to_cart_validation’, ‘limit_single_vendor_to_cart’, 10, 3 ); function limit_single_vendor_to_cart( $valid, $product_id, $quantity ) { $vendor_id = get_post_field( ‘post_author’, $product_id ); // loop through the cart to check each vendor id foreach ( WC()->cart->get_cart()…Continue reading

Product Expiry For Woo

/** * Add support for Product Expiry for WooCommerce Plugin */ if ( class_exists( ‘WOO_Product_Expiry’) ){ /** * Add fields to the product edit form under prices */ function wcv_pefwc_add_fields( $post_id ){ // Expiry date field. $expiry_date = get_post_meta( $post_id,…Continue reading

Download Manager

/** * Stop Download Manager frontend script from loading on the Pro dashboard. * */ function wcv_dequeue_wpdm_script() { $dashboard_page_id = (array) get_option( ‘wcvendors_dashboard_page_id’, array() ); foreach ( $dashboard_page_id as $page_id ) { if ( is_page( $page_id ) ) { wp_dequeue_script(…Continue reading

AIO Dashboard

/** * Disable All In One SEO on the vendor dashboard. */ add_filter( ‘aioseo_disable’, ‘wcv_aioseo_disable_term_output’ ); function wcv_aioseo_disable_term_output( $disabled ) { $current_page_id = get_the_ID(); if ( wcv_is_dashboard_page( $current_page_id ) ){ return true; } return false; }Continue reading

Elementor Store Headers

// Add the woocommerce_before_main_content to the elementor wc-archive-products widget add_action( ‘elementor/widget/render_content’, function( $content, $widget ) { if ( ‘wc-archive-products’ === $widget->get_name() ) { // Run the hooks without outputting the code that `do_action` will want to do ob_start(); do_action(‘woocommerce_before_main_content’); $beforeMainContent…Continue reading

Min-Max Product Price (with decimal support)

add_filter( ‘wcv_product_price’, ‘price_min_max’ ); function price_min_max( $args ) { $args[‘custom_attributes’] = array( ‘min’ => 3.2, ‘max’ => 200.21, ‘step’ => 0.01, ‘data-parsley-type’ => ‘number’, ‘data-parsley-range-message’ => __( ‘Price must be between 3.2 and 200.01’, ‘wcvendors-pro’ ), ‘pattern’ => ‘[0-9]+([\.,][0-9]+)?’, ‘type’…Continue reading