Disable WooCommerce Payment Gateways Based On Cart Amount

If you want to disable payment gateway based on Cart total and show only specific Payment method if cart amount higher than specific amount than using country in WooCommerce filter woocommerce_available_payment_gateways you able to easily apply in your WooCommerce wordpress website

add_filter( 'woocommerce_available_payment_gateways', 'wdo_filter_gateways', 1);
function wdo_filter_gateways( $gateways ){
	if ( WC()->cart->prices_include_tax )
		$cart_contents_total = WC()->cart->cart_contents_total + array_sum( WC()->cart->taxes );
	else
		$cart_contents_total = WC()->cart->cart_contents_total;
	if($cart_contents_total < 1499) {
		unset($gateways['cod']);
	}
	return $gateways;
}

Leave a Comment

Scroll to Top