Home / Admin / Commissions as a fixed dollar amount, or fixed plus a percentage.
Duplicate Snippet

Embed Snippet on Your Site

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

Code Preview
php
<?php
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 item sold -- Change to whatever $ amount you want!
	$commission_rate 	= WCV_Commission::get_commission_rate( $product_id ); //get product specific rate
	$commission      	= $product_price * ( $commission_rate / 100 ); //compute commission
	$commission      	= round( $commission, 2 ) - $per_item_addition; //round and remove per item fee.
	if ( $commission < 0 ) $commission = 0; //set to 0 if less than 0
	return $commission;
}

Comments

Add a Comment