plugins – Woocommerce if use a specific gateway, then set the value

Question

I want to add a filter or an action for the plugin, the purpose is to set the value to “0” if the order used “myCRED” gateway.

I found those 2 related filters of the plugin,

uap_filter_referral_amount
uap_public_filter_on_referral_insert_amount_value

actually, I am not sure which one should I use, but I tried both of the 2 filters, when checkout it shows internal error, I think the code may have some error, any one can help?

Here is the code I have tried:

function 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');

0
Nicholas Lee 2 weeks 2021-09-11T11:25:16-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse