(1) I am not completely sure if I understood the issue correctly, but does that mean the same order generates earnings twice?
It would help if you can share a screenshot.
Certainly, that should not happen, and an order should only generate earnings once. Perhaps however there is a misconfiguration or some kind of conflict.
If you'd like, we can check this directly on your site and troubleshoot the issue. For that, we would need a backend login to the site, or to a staging clone site.
(2)
Regarding changing an agent, please note it is normal that this area does not change commissions:
This area only controls who can edit / manage the order.
If you want to edit commissions for an order, please scroll down to the bottom of the edit order page and edit commissions via the panel here:
To delete a commission here, please click on the pencil icon and then enter 0:
Then after saving the order, the commission is deleted.
I looked further into that and it seems the hook I used did not work as a snippet there.
Please try those steps again exactly as previously, but with the following code:
add_action('admin_init', function(){
// also get all earnings where this agent is parent
$earnings = get_posts( array(
'post_type' => 'salesking_earning',
'numberposts' => -1,
'post_status' => 'any',
'fields' => 'ids',
'meta_key' => 'order_id',
'meta_value' => '5321',
));
foreach ($earnings as $earning_id){
wp_delete_post($earning_id);
}
delete_post_meta(5321,'salesking_earning_id', '');
});
I tested this code locally with that code snippets plugin, set to "execute once" and it seems to work in my tests. If for some reason this does not work for you, could you please share a backend access to the site or staging site, so we can work on it directly?
Earnings record is duplicated. Duplicate cannot be deleted. Even when agent is changed, the duplicate for the previous agent does not go away.
Hi Virginia,
Thank you for purchasing our plugin,
(1) I am not completely sure if I understood the issue correctly, but does that mean the same order generates earnings twice?
It would help if you can share a screenshot.
Certainly, that should not happen, and an order should only generate earnings once. Perhaps however there is a misconfiguration or some kind of conflict.
If you'd like, we can check this directly on your site and troubleshoot the issue. For that, we would need a backend login to the site, or to a staging clone site.
(2)
Regarding changing an agent, please note it is normal that this area does not change commissions:
This area only controls who can edit / manage the order.
If you want to edit commissions for an order, please scroll down to the bottom of the edit order page and edit commissions via the panel here:
To delete a commission here, please click on the pencil icon and then enter 0:
Then after saving the order, the commission is deleted.
Looking forward to your response,
Kind regards,
Stefan
Hi Virginia,
Thank you for the detailed reply,
I believe most likely the issue was related to a previous plugin bug which is now resolved.
To correct the issue for that specific order, please try the following:
1. Set the order status to 'processing'
2. Add this code snippet to your site:
https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
Run the snippet only once, so that the earnings are deleted.
3. Remove the code snippet.
4. Then go to the order page and add the commission manually
5. Set the status back to completed.
Hopefully that should correct it for this specific order and the issue should not return.
Let me know if that can solve it for you,
Kind regards,
Stefan
Hi Virginia,
I looked further into that and it seems the hook I used did not work as a snippet there.
Please try those steps again exactly as previously, but with the following code:
I tested this code locally with that code snippets plugin, set to "execute once" and it seems to work in my tests. If for some reason this does not work for you, could you please share a backend access to the site or staging site, so we can work on it directly?
Kind regards,
Stefan