Public Ticket #3589439

Error in commission calculation

Closed
Comments
6 Tickets 1
sacha started the conversation 3 years ago on February 21, 2024 at 10:22am

Hi there, 


i hope you are well. Please may i get some advice:

We want the commission to match the profit on the order
Profit on order shows R37.35 which is R147.83 (price of product) - R102.35(cost of product) - R8.12 (3.5% handling fee on order). The earnings/commission are showing R45.51 as they not deducting off the handling fee to the commission. I need the handling fee to be deducted off the commission. Please kindly advise how this can be done.


2,762
KingsPlugins replied 3 years ago on February 24, 2024 at 3:14pm

Hi there,

If I understand correctly, your commission rule is essentially set to 100% ? 

I believe you could get this to work, by adding the following PHP code snippet to your site:

add_filter('salesking_custom_calculation_basis', function($basis, $order){
    // get 3.5% of order
    $total = $order->get_total();
    $handlingfee = 3.5/100*$total;
    $basis+= $handlingfee;
    return $basis;
}, 10, 2);

This should basically add an extra 3.5% of the order value to the commission.


Let me know if that can help solve it. If not, it would be quite helpful if you were able to share site access or access to a staging site with us. That way we could look into this and test directly. It's possible I may be otherwise missing something relevant in the configuration.


Kind regards,

Stefan

2,762
KingsPlugins replied 3 years ago on March 4, 2024 at 10:15am

Hello Sacha,

Thank you for your patience on this,


And my apologies, I think I originally misunderstood.


Is it correct that the profit should always be equal to the commission? So here it should simply be 37.35?

2280017092.png


It would be great if you could please share a backend login to the site or a staging site. I will then try to work directly to set that up. I am not 100% sure how we need to modify it depending on how that fee works, so it would be great if I could work on it and test directly.


Kind regards,

Stefan

2,762
KingsPlugins replied 3 years ago on March 10, 2024 at 1:39pm

Hi Sacha,

I'd be glad to assist if I can,

What I previously did was that I added a code snippet which automatically takes the profit calculated by the Cost of Goods plugin and sets that as the SalesKing commission.


Regarding how to modify the handling fee / costs, I'm afraid I do not have a lot of experience with this myself - I do not know the cost of goods plugin that well, we just have a basic integration with it there.

Is it possible that you can make a modification to your setup, either by modifying cost or modifying the handling fee, so that the final profit shown there is equal to the correct agent commission?


Or perhaps is there a simple formula we could apply to SalesKing, such as "agent commission = profit * 90%" ? I could set up such a formula programmatically.

Sign In