Site icon Hip-Hop Website Design and Development

Woocommerce if use a particular gateway, then set the worth [closed]

I need to add a filter or an motion for the plugin, the aim is to set the worth to "0" if the order used "myCRED" gateway.

I discovered these 2 associated filters of the plugin,

uap_filter_referral_amount
uap_public_filter_on_referral_insert_amount_value

truly, I’m not positive which one ought to I exploit, however I attempted each of the two filters, when checkout it reveals inner error, I feel the code could have some error, anyone may help?

Right here is the code I’ve tried:

operate exclude_mycred_gateway( $order ){
    $payment_title = $order->get_payment_method_title();
    if ( $payment_title ) {
        $payment_title == "myCRED";
        return "0";
    }
}

add_filter( 'uap_filter_referral_amount', 'exclude_mycred_gateway');