Enable support for WooCommerce Price Based on Country
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
<?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