Loading...
asked 5 month ago Votes
0 Answers
0 Views
I am using the following snippet to disable a specific payment method in Woocommerce, based on the total value of the cart.
add_filter( 'woocommerce_available_payment_gateways', 'show_hide_payment_methods' );
function show_hide_payment_methods( $available_gateways ) {
if ( ( WC()->cart->total >= 1000 ) ) {
if ( isset($available_gateways['cod']) ) {
unset($available_gateways['cod']);
}
}
return $available_gateways;
}