Disable cashback when payment made through wallet

[ad_1]

Hi,

I am trying to prevent users from receiving cashback when they make a payment through the wallet.
I have added the following piece of code in the functions.php of my website’s active theme:

add_filter('woo_wallet_form_order_cashback_amount', 'woo_wallet_form_order_cashback_amount_callback');
if (!function_exists('woo_wallet_form_order_cashback_amount_callback')) {
        function woo_wallet_form_order_cashback_amount($cashback_amount, $order_id) {

                $order = wc_get_order( $order_id );
                $payment_method = $order->get_payment_method();
                if ($payment_method == 'wallet') {
                        $cashback_amount = 0;
                }
                return $cashback_amount;
        }
}

However, this does not enforce the mentioned action. Would it be possible for you to suggest a solution to this problem?

Regards,
Rajat

  • This topic was modified 3 hours, 4 minutes ago by rkumarr15.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer