Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

Commission Modifictaion for COD

Show commission as 0 for cash on delivery order #

If a buyer want to pay on the delivery, the marketplace admin, won’t have a new commission to pay as the whole payment process will be offline and there is no control over it.

So, you may set the commission amount 0 for this, using the below code

add_action( 'mvx_commission_after_save_commission_total', 'zero_commission' );
function zero_commission( $commission_id ) {
    $order_id = get_post_meta( $commission_id, '_commission_order_id', true );
    $order = wc_get_order($order_id);
    $payment = $order->get_meta( '_payment_method', true );
    if( $payment == 'cod' ) {
        update_post_meta( $commission_id, '_commission_amount', 0 );
        update_post_meta( $commission_id, '_commission_total', 0 );

Exclude commission for offline payment #

If a customer chooses to pay COD. The money will not be going through admin, so it might be useful to exclude the commission for vendor. For this add this code in the function.php of the theme :

// paid commission automaticly for cod payment 
add_action( 'after_wcmp_calculate_commission', function( $commission_id, $vendor_order_id ) 
$payemnt_method = get_post_meta( $vendor_order_id , '_payment_method' , true ); if( $payemnt_method == 'cod' ) {
update_post_meta( $commission_id , '_paid_status' , 'paid' ); 

Leave a Reply