Woocommerce User country detection php code
/** * @snippet       Get Current User Country (Geolocation) - WooCommerce * @how-to        Get CustomizeWoo.com FREE * @sourcecode    https://businessbloomer.com/?p=72811 * @author        Rodolfo Melogli * @compatible    Woo 3.5.3 * @donate $9     https://businessbloomer.com/bloomer-armada/ */function bbloomer_use_geolocated_user_country(){// Geolocation must be enabled @ Woo Settings$location = WC_Geolocation::geolocate_ip();$country = $location['country'];// Lets use the country to e.g. echo greetingsswitch ($country) {    case "IE":        $hello = "Howya!";        break;    case "IN":        $hello = "Namaste!";        break;    default:        $hello = "Hello!";}echo $hello;}add_action( '_______', 'bbloomer_use_geolocated_user_country' );
No comments:
Post a Comment