Created
July 21, 2017 11:42
-
-
Save NiklasHogefjord/68616f9ebb4f36633b284517b31924f1 to your computer and use it in GitHub Desktop.
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
add_filter( 'woocommerce_get_checkout_url', 'krokedil_change_checkout_url', 30 ); | |
function krokedil_change_checkout_url( $url ) { | |
$allowed_countries = array( 'SE', 'NO', 'FI', 'DE', 'DK', 'AT', 'UK', 'US' ); | |
$customer_country = WC()->customer->shipping_country; | |
if( !in_array( $customer_country , $allowed_countries ) ) { | |
$url = wc_get_page_permalink( 'checkout' ); | |
} | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment