Skip to content

Instantly share code, notes, and snippets.

@elvinlee
Last active August 29, 2015 14:13
Show Gist options
  • Save elvinlee/3854c1be3746ff5b2181 to your computer and use it in GitHub Desktop.
Save elvinlee/3854c1be3746ff5b2181 to your computer and use it in GitHub Desktop.
WooCommerce: Disable BACS if Customer Checkout Country Out of Singapore
add_filter( 'woocommerce_available_payment_gateways', 'bacs_disable_outside_singapore' );
//Disable bacs if the country not in Singapore
function bacs_disable_outside_singapore( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['bacs'] ) && $woocommerce->customer->get_country() <> 'SG' ) {
unset( $available_gateways['bacs'] );
}
return $available_gateways;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment