+91 9737971210
info@wordpressdeveloperonline.com
Facebook
Facebook
Twitter
Twitter
Google+
Google+
LinkedIn
LinkedIn
Instagram
Instagram
WORDPRESS DEVELOPER
Menu
  • HOME
  • SERVICES
    • Free WordPress Setup
      • Free WordPress Website Blog
    • Hire WordPress Developer
      • WordPress Emergency Support
      • Hire PHP Developer
      • Hire WooCommerce Developer
      • Woocommerce Customization
      • Fix WordPress Errors
      • Fix WordPress Security
      • Multi Language Website Blog with WPML
    • Online Shopping Website
    • WordPress Theme Development
      • Avada Theme Experts
      • Divi Expert Services
      • Enfold Theme Expert
      • Jupiter Theme Expert
      • X Theme Expert Services
      • NewsPaper Theme Experts Services
    • PSD to WordPress
    • Speed Performance Optimization
    • WordPress Hosting Migration
    • SEO Link Building
  • PACKAGES
    • Speed Optimization Packages
  • WHY WE
    • PORTFOLIO
    • TESTIMONIALS
    • CAREER
  • BLOG
  • CONTACT

Disable WooCommerce Payment Gateways Based On Cart Amount

February 20, 2020wordpressdeveloperUncategorized

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;
}