• freddyeee

    (@freddyeee)


    Hi

    How can I make the bubble chat to appear just in certain countries ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter freddyeee

    (@freddyeee)

    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.
    Plugin Author Creame

    (@creapuntome)

    Hi, you can take a look at this post in our blog: How to show Joinchat only in certain countries

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.