Created
February 10, 2016 14:02
-
-
Save hussong/d9e4e33435050dcd6bbd to your computer and use it in GitHub Desktop.
WooCommerce show Cash on Delivery for specific customer country only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_payment_gateways( $available_gateways ) { | |
global $woocommerce; | |
/* Remove CoD if shipping outside of DE */ | |
if ( isset( $available_gateways['cod'] ) && $woocommerce->customer->get_country() != 'DE' ) { | |
unset( $available_gateways['cod'] ); | |
} | |
return $available_gateways; | |
} | |
add_filter( 'woocommerce_available_payment_gateways', 'my_payment_gateways' ); |
How would the function look like when I want to have COD only for some countries? In addition to this would there be a way to have one COD-fee for Germany and for the other countries another COD-fee?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! How does it looks like when i want wo enable the gateway invoice only in DE?