Okay
  Public Ticket #3589439
Error in commission calculation
Closed

Comments

  • sacha started the conversation

    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.


    Attached files:  Screenshot 2024-02-21 at 12.19.59.png
      Screenshot 2024-02-21 at 12.20.08.png

  •  1,893
    WebWizards replied

    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

  •   sacha replied privately
  •   sacha replied privately
  •  1,893
    WebWizards replied

    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

  •   sacha replied privately
  •   WebWizards replied privately
  •   sacha replied privately
  •  1,893
    WebWizards replied

    I believe I was able to set that up now.

    I placed the following order:

    https://salondirect.co.za/wp-admin/admin.php?page=wc-orders&action=edit&id=11114

    The profit and agent commission are the same, 36.38


    Let me know if you have any issues with it,

  •   sacha replied privately
  •  1,893
    WebWizards replied

    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.