Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active Mar 18, 2020
Embed
What would you like to do?
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