Public Ticket #3691311

Get commission on Cancelled and Refunded orders

Closed
Comments
15 Tickets 7
Eana started the conversation 2 years ago on July 23, 2024 at 7:30am

We want to get commission on all order statuses excluding "pending-payment".

We saw a code that can help but when the order status is canceled or refunded, the commission on that particular order is 0.
We still want a commission even if the order is canceled or refunded.

Here is the code that we used:

add_filter('salesking_earning_completed_statuses', function($statuses){
      $statuses = array('completed', 'processing', 'on-hold', 'refunded', 'cancelled');
      return $statuses;
}, 10, 1);



Is there a workaround to achieve this?

Thanks

2,762
KingsPlugins replied 2 years ago on July 23, 2024 at 12:53pm

Hello Eana,

Thank you for purchasing our plugin,


The code you are using there seems mostly correct, but that code is for the 'SalesKing' plugin. I understand you are using MarketKing (multivendor marketplace plugin).

Therefore the code should be:

add_filter('marketking_earning_completed_statuses', function($statuses){
      $statuses = array('completed', 'processing', 'on-hold', 'refunded', 'cancelled');
      return $statuses;
}, 10, 1);

I believe that should indeed set it so that all order statuses except 'pending-payment' grant the commission.


Let me know if that works for you or if you run into any issues,


Kind regards,

Stefan

15 Tickets 7
Eana replied 2 years ago on July 24, 2024 at 6:50am

Hi Webwizard,


We have now updated the code to match the one you provided. However, we are getting the same results. It is still not working when the order status is cancelled or refunded, other statuses work.


Kind Regards

2,762
KingsPlugins replied 2 years ago on July 26, 2024 at 9:51am

Hi again,

Perhaps the issue is that you are testing this on previously existing orders (From before adding the code snippet).

The way this works is that the balance is only updated when an order status change happens. For the vendor balance to be increased, the status change needs to be from a status that does not grant commission, to one that does, so in this case from "Pending payment" to "Cancelled" / "Refunded". 


How are you testing this? / what is the flow?

Or if you'd like to share a backend login to the site or staging site, we are also happy to troubleshoot directly,


Kind regards,

Stefan

15 Tickets 7
Eana replied 2 years ago on July 26, 2024 at 10:59am

Hi WebWizard,


I see. Yes, we are testing existing orders that were added before the code was added.

We tested it now with new orders and is now working.

Thanks for your help.


Kind Regard

1
15 Tickets 7
Eana replied 2 years ago on September 16, 2024 at 7:20am

Hi,

I need to go back on this one.


The code is not working.

When the order is canceled, the commission will still get counted. However, when a new order comes up, the commission of the previous canceled order is not counted on the total commission.


Can you please check on your end?


Kind Regards

15 Tickets 7
Eana replied 2 years ago on September 16, 2024 at 7:37am

Hi,

Also, when placing an order to be refunded, the commission goes 0. When you change it back to processing or completed, it does not put the commission back, it remains 0.


Kind Regards

Sign In