Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Marketplace › Commission invoice – Taxe on commission
Tagged: marketplace invoice commission
- This topic has 3 replies, 3 voices, and was last updated 4 years, 8 months ago by WCFM Forum.
- AuthorPosts
- February 28, 2020 at 7:38 pm #109215Nassima BENNAIParticipant
Hi,
Here is how I setup my commission :
commission : for admin
commission mode : pourcentage
expedition fees : for vendor
taxes : for vendor
commission calculated after coupon applyMy problem : the taxe on commission. it’s calculated on the (total amount – commission) and not on the commission only.
Ex.
commission : 10% for admin
Commission taxe : 20%
Total cart : 1000€The result must be : 100€ commission for admin with 16,67€ taxe included (100 – 100 / 1 + 20% )
The result given : 100€ commission + 180€ of taxes (1000 – 100 = 900 x 20% = 180)Any idea to fix it ?
Thanks!
- March 4, 2020 at 2:01 pm #109879WCFM ForumMember
Hi,
Well, by default commission tax always applicable on vendor’s commission amount.
If you want to apply on Admin’s commission then add this code to your site –
add_action( 'wcfmmp_order_item_processed', function( $commission_id, $order_id, $order, $vendor_id, $product_id, $order_item_id, $grosse_total, $total_commission, $is_auto_withdrawal ) { global $WCFM, $WCFMmp, $wpdb; if( apply_filters( 'wcfm_is_admin_fee_mode', false ) ) { $commission_rule = unserialize( $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, 'commission_rule' ) ); if( isset( $commission_rule['tax_enable'] ) && ( $commission_rule['tax_enable'] == 'yes' ) ) { $gross_sale_order = (float) $WCFM->wcfm_vendor_support->wcfm_get_gross_sales_by_vendor( $vendor_id, '', '', $order_id ); $commission_tax = (float) $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, 'commission_tax' ); $total_commission += $commission_tax; $admin_fee = (float) $gross_sale_order - (float) $total_commission; $commission_tax = $admin_fee * ( (float)$commission_rule['tax_percent'] / 100 ); $total_commission -= (float) $commission_tax; $WCFMmp->wcfmmp_commission->wcfmmp_delete_commission_meta( $commission_id, 'commission_tax' ); $WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, 'commission_tax', round($commission_tax, 2) ); $wpdb->update("{$wpdb->prefix}wcfm_marketplace_orders", array('total_commission' => $total_commission), array('ID' => $commission_id), array('%s'), array('%d')); $wpdb->update("{$wpdb->prefix}wcfm_marketplace_vendor_ledger", array( 'credit' => $total_commission ), array( 'reference_id' => $commission_id ), array( '%s' ), array( '%d' ) ); } } }, 50, 9 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/Thank You
- April 7, 2020 at 12:26 pm #116255Philip BaumgartnerParticipant
Thank you, also helped me as I needed the same feature 🙂
- April 12, 2020 at 12:35 pm #118336WCFM ForumMember
Great … you are welcome 🙂
- AuthorPosts
- You must be logged in to reply to this topic.