PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Functionality with Vendors

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
12

Hello

Try  in file  functions.php  add this  code: ( This will only keep commissions in one currency )

//WCMP
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);

to correctly convert the amount of orders In  file  -"\wp-content\plugins\dc-woocommerce-multi-vendor\classes\class-wcmp-vendor-details.php"  change  code( https://c2n.me/49s6SiQ.png ) instead of( https://c2n.me/49s6Yof.png ) :

$sales_total_item= $order->get_total();
$discount_amount_item = $order->get_total_discount();
if (class_exists('WOOCS')) {
global $WOOCS;
$_order_currency = get_post_meta($order->get_id(), '_order_currency', true);
$order_rate = get_post_meta($order->get_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){
$sales_total_item = $WOOCS->back_convert($sales_total_item,$order_rate, 2);
$discount_amount_item = $WOOCS->back_convert($discount_amount_item,$order_rate, 2);
}
}
$sales_total += $sales_total_item;
$discount_amount += $discount_amount_item;

 

Hi Pablo,

Greetings!

Thanks for implementing this functionality.

However, I have 2 concerns

  1. The amount is converted correctly. But the email which is sent to the vendor after the order is received still has the original issue.
  2. Should I remove the code which I added from the dokan compatibility earlier? - https://currency-switcher.com/dokan/

Here is the code which is still active in functions.php

I am afraid it should not create any problem with the code you added now.

This code -

/* WOOCS Integration code with DOKAN

add_action('woocommerce_order_status_completed', 'woocs_payment_complete', 1);
add_action('woocommerce_payment_complete', 'woocs_payment_complete');

function so_payment_complete($order_id) {
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
$WOOCS->recalculate_order($order_id);
}
}

add_filter('wp_head', function() {
if (is_page('dashboard')) {
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
}
});

*/

However, I think I need only the lower part of the code now so vendor dashboard always show base currency

/* WOOCS Integration code with DOKAN

add_action('woocommerce_order_status_completed', 'woocs_payment_complete', 1);
add_action('woocommerce_payment_complete', 'woocs_payment_complete');

add_filter('wp_head', function() {
if (is_page('dashboard')) {
if (class_exists('WOOCS')) {
global $WOOCS;
$WOOCS->reset_currency();
}
}
});

*/

Hello

Yes, remove this code if you don't use the plugin

Hi,

Commissions are now recorded correctly but in the email, it is still wrong. When you place a test order, the vendor receives an email. That email still has the incorrect currency.

In email also, the amount should be in base currency.

Can you please check that?

Thank you

 

Yes we'll check it  on Thursday

Alright Pablo, thanks

Quick update:

The commission panel is working good but at some places, currency issue is still there. Please check these places

  1. Commission panel (working good): https://prnt.sc/v31r3i

2. Email (not working):  https://prnt.sc/v31rhv

3. Vendor dashboard orders section (Not working) - https://prnt.sc/v31ra7

The link to the vendor dashboard order section is given in the private section.

Hello

Ok!  Thank  you  for info

Hello

In  file -"\wp-content\plugins\dc-woocommerce-multi-vendor\templates\vendor-dashboard\vendor-orders\views\html-order-item.php"  change code - https://c2n.me/49xoLSI.png

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" - change code - https://c2n.me/49xp1qz.png

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"- change  code - https://c2n.me/49xpfgW.png

if(class_exists('WOOCS')){
global $WOOCS;
$WOOCS->reset_currency();
}

+ change  code -  https://c2n.me/49xplcR.png

if(class_exists('WOOCS')){
global $WOOCS;
$WOOCS->reset_currency();
}

+ change  code - https://c2n.me/49xpp4o.png

if(class_exists('WOOCS')){
global $WOOCS;
$WOOCS->reset_currency();
}

+ change  code - https://c2n.me/49xpuoF.png

if(class_exists('WOOCS')){
global $WOOCS;
$WOOCS->reset_currency();
}

Hi Pablo,

Thanks for this. It is working fine.

However, changes you have suggested in on editing the classes file. That means I cannot override them in child theme.

This will make it difficult when updating the plugins.

Can you suggest making these changes via hooks on functions.php file?

Thanks

Hello

Unfortunately not

That's all you can do in functions.php - https://c2n.me/49AC4X8.png

12