I made this code to hide the bubble on the US, but it didn’t work:
Functions.php on child theme
add_action('wp_enqueue_scripts', 'pasar_geolocalizacion_js');
function pasar_geolocalizacion_js() {
$user_country = WC_Geolocation::geolocate_ip();
wp_enqueue_script('ocultar-joinchat', get_template_directory_uri() . '/js/ocultar-joinchat.js', array('jquery'), null, true);
wp_localize_script('ocultar-joinchat', 'userLocation', array(
'country' => $user_country['country'],
));
}
JS file name “ocultar-joinchat.js” on child theme
jQuery(document).ready(function($) {
if (userLocation.country === 'US') {
$('#joinchat__peak_l').hide();
$('.joinchat__button').hide();
}
});
what could I do ?
-
This reply was modified 1 month ago by freddyeee.