Answers for "woocommerce remove payment method when totla is 0"

PHP
0

woocommerce remove payment method when totla is 0

function payment_gateway_disable_total_amount( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['paypal'] ) && $woocommerce->cart->total == 0 ) {
    unset(  $available_gateways['paypal'] );
}
    return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_total_amount' );
Posted by: Guest on November-02-2020

Code answers related to "woocommerce remove payment method when totla is 0"

Browse Popular Code Answers by Language