It is possible to set it to 0 on cancelled orders. To do that, you can add this PHP snippet to your site:
add_action('woocommerce_order_status_cancelled', 'update_salesking_commission_on_cancel', 1000, 1);
function update_salesking_commission_on_cancel($order_id) {
$order = wc_get_order($order_id);
$earning_id = $order->get_meta('salesking_earning_id');
if ($earning_id) {
$total_earnings_on_order = get_post_meta($earning_id, 'salesking_commission_total', true);
// Update the commission total to 0
update_post_meta($earning_id, 'salesking_commission_total', 0);
}
}
Please note that it will no longer show on the "Earnings" page after cancelled (it will show only on the Orders page), because the plugin does not show earnings equal to 0 there.
Hi is there any smart code snippet to change commission to 0 $ after order cancelled ??
(picture attached)
Attached files: Zrzut ekranu 2024-09-26 o 15.59.38.png
Hi there,
It is possible to set it to 0 on cancelled orders. To do that, you can add this PHP snippet to your site:
Please note that it will no longer show on the "Earnings" page after cancelled (it will show only on the Orders page), because the plugin does not show earnings equal to 0 there.
Kind regards,
Stefan