In file functions.php of your current wp child theme add next code:
add_filter('vendor_commission_amount', function ($amount, $product_id, $variation_id, $item, $order_id, $item_id) {
if (class_exists('WOOCS')) {
global $WOOCS;
$_order_currency = get_post_meta($order_id, '_order_currency', true);
$order_rate = get_post_meta($order_id, '_woocs_order_rate', true);
$currencies = $WOOCS->get_currencies();
if (!$order_rate) {
if (isset($currencies[$_order_currency])) {
$order_rate = $currencies[$_order_currency]['rate'];
}
}
if ($order_rate) {
$amount = $WOOCS->back_convert($amount, $order_rate, 2);
}
}
return $amount;
}, 99, 6);
(This will only keep commissions in one currency)
to correctly convert the amount of orders In file - "wp-content\plugins\dc-woocommerce-multi-vendor\classes\class-wcmp-vendor-details.php" change code from
to
In file - "wp-content\plugins\dc-woocommerce-multi-vendor\templates\vendor-dashboard\vendor-orders\views\html-order-item.php" change code:
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
echo '<div class="commission">' . wc_price($commission) . '</div>';
if (class_exists('WOOCS')) {
$_order_currency = get_post_meta($order->get_id(), '_order_currency', true);
$WOOCS->set_currency($_order_currency);
}
AND in file - "wp-content\plugins\dc-woocommerce-multi-vendor\classes\class-wcmp-vendor-details.php" - add code:
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
AND in file - "wp-content\plugins\dc-woocommerce-multi-vendor\classes\class-wcmp-post-commission.php"- add code:
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
+ add code:
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
also in the same file add code:
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
🌸
Shortcodes, functions, actions and filters reference for FOX WooCommerce Currency Switcher
Codex — FOX Currency Switcher
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.