xyzmurali
Forum Replies Created
-
I figured out the solution
Forum: Plugins
In reply to: [Frontier Post] shortcode not working in woocommerce myaccount tabOkay, thanks for your response. I moved it to a page now.
Thanks very much for the pointer. I will give it a try
Regards,
MuraliAwesome, it worked. Thanks a lot
it works for me for multiple products from multiple vendors
Any update on this?
Ex. if an order is placed for 100 + 40 shipping. The shipping is done by the marketplace. customer pays 140. say if admin commission is 10% and shipping does not go to vendor. commission of 10 on invoice is raised to vendor. In case if this order is returned by customer due to quality issues, 140 will be refunded to the customer. The commission invoice of 10 is changed to 0, but the shipping charge of 40 should still be charged to the vendor as the refund happened due to vendor, else this 40 will be a loss to the marketplace. so on returned and refunded order, the shipping charge should be added to commission invoice with an option of both forward and reverse shipping. Even though an order is returned both the forward and shipping charged are incurred and it has to be borne by the vendor. The system has to either calculate it in the commission invoice or allow to raise separate invoices to vendors apart from the commission invoice for these kind of misc expenses.
@maximevill : I customized the commission calculation by adding the below code as a snippet (I am not sure if this will help you, but will give you an idea of how I solved it)
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’, true ) ) {
$commission_rule = unserialize( $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, ‘commission_rule’ ) );
$gross_sales_total = $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, ‘gross_sales_total’ );
$gross_tax_cost = $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, ‘gross_tax_cost’ );
$gross_shipping_cost = $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, ‘gross_shipping_cost’ );
$gross_shipping_tax = $WCFMmp->wcfmmp_commission->wcfmmp_get_commission_meta( $commission_id, ‘gross_shipping_tax’ );$item_total = (float) $gross_sales_total – (float) $gross_tax_cost – (float) $gross_shipping_cost – (float) $gross_shipping_tax;
//$admin_fee = $gross_sales_total * ( (float)$commission_rule[‘percent’] / 100 );
$gross_total_order_value = (float) $gross_sales_total;
$commission_fee = (float) $gross_total_order_value * ( 6 / 100 );
$payment_processing_fee = (float) $gross_total_order_value * ( 2 / 100 );
$shipping_fee = (float) $gross_shipping_cost + (float) $gross_shipping_tax;
$marketplace_fee = (float) $commission_fee + (float) $payment_processing_fee + (float) $shipping_fee;
$gst = (float) $marketplace_fee * ( 18 / 100 );
$tcs = (float) (1 / 100) * ($item_total);$total_vendor_commission = $gross_total_order_value – $marketplace_fee – $gst – $tcs ;
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘gross_total_order_value’, round($gross_total_order_value, 2) );
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘commission_fee’, round($commission_fee, 2) );
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘payment_processing_fee’, round($payment_processing_fee, 2) );
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘shipping_fee’, round($shipping_fee, 2) );
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘marketplace_fee’, round($marketplace_fee, 2) );
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘gst’, round($gst, 2) );
$WCFMmp->wcfmmp_commission->wcfmmp_update_commission_meta( $commission_id, ‘tcs’, round($tcs, 2) );$wpdb->update(“{$wpdb->prefix}wcfm_marketplace_orders”, array(‘total_commission’ => round($total_vendor_commission,2)), array(‘ID’ => $commission_id), array(‘%s’), array(‘%d’));
}}, 50, 9 );
Thanks for your response. I am able to use WCFM custom field and add a new tab. How to get the field inside existing tabs like General or Tax
Thank you
I added the below condition in wc-frontend-manager/views/products-manager/wcfm-view-products-manage.php and it seems to work. Please confirm if the change is fine
if ( ! empty( $tax_classes ) ) {
foreach ( $tax_classes as $class ) {
if (strpos($class, get_user_meta( $current_user_id, ‘_wcfm_state’, true )) !== false) {
$tax_classes_options[ sanitize_title( $class ) ] = esc_html( $class );
$variation_tax_classes_options[ sanitize_title( $class ) ] = esc_html( $class );
}
}
}Hi, Any Update on this please
Any update on this?
Thanks for your response. But Doesn’t answer the issue. It looks likes you are copy pasting the same code as a solution for every query related to tax on admin commission where you dont even change the if condition which is used for tax on vendor commission (‘wcfm_is_admin_fee_mode’, false).
This solution does not work, How can we calculate commission on the total order value (including tax, shipping) instead of adding commission to product, tax, shipping separately. Adding them separately creates values of tax and shipping wrongly in the commission invoices which is not desired.
Can you please provide code to calculate commission on total order value instead please?