lacee1986
8/9/2016 - 3:53 PM

Conditional payment for Woocommerce

Conditional payment for Woocommerce

add_filter('woocommerce_available_payment_gateways','filter_gateways', 10, 1 );
function filter_gateways($gateways){
  global $woocommerce;
  $total = WC()->cart->get_total();
  $total = strip_tags($total);
  $total = preg_replace('/\D/', '', $total)/100;

  if ((float)$total > 99.99) {
      unset($gateways['realex_redirect']);
  }
  return $gateways;
}