mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/75620124/exclude-orders-paid-from-account-funds-from-reports-woocommerce
12 lines
422 B
Text
12 lines
422 B
Text
add_filter('woocommerce_order_get_total', 'exclude_account_funds_payment', 10, 2);
|
|
|
|
function exclude_account_funds_payment($total, $order){
|
|
// Get the payment method used for the order
|
|
$payment_method = $order->get_payment_method();
|
|
|
|
// Exclude the order total for Account Funds payment method
|
|
if($payment_method == 'account_funds') {
|
|
$total = $total - $order->get_total_paid();
|
|
}
|
|
return $total;
|
|
}
|