Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active March 18, 2020 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timersys/5b883c3fac65fcad87d4dc7def67e55b to your computer and use it in GitHub Desktop.
Save timersys/5b883c3fac65fcad87d4dc7def67e55b to your computer and use it in GitHub Desktop.
Enable support for WooCommerce Price Based on Country
<?php // don't include this line
/**
* Enable support for WooCommerce Price Based on Country and GeotargetingWP
* First enable cache mode or you will consume lot of credits.
*/
if( function_exists('geot_country_code')) {
add_action( 'init', 'geotwp_wcpb_set_country', 10 );
function geotwp_wcpb_set_country(){
if( ! function_exists('wcpbc_set_woocommerce_country') )
return;
wcpbc_set_woocommerce_country( geot_country_code() );
}
// Woocommerce
add_filter('woocommerce_geolocate_ip' , 'woo_geolocate_ip', 99 );
function woo_geolocate_ip() {
return geot_country_code();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment