Multiple execution of a pop-up made in php and jquery

I have a code to display a pop. The problem with this code is that it is executed several times if I want it to be executed only once.
This pop-up is for the user to click on their country and change its currency.
But when the pop-up comes up and we set the country, the page is refreshed again and the same pop-up appears.
Do you have a solution to fix this problem?
My code example:

    if(!isset($_COOKIE[$isfirstsee])) {
        global $WOOCS;
        $WOOCS->set_currency('GBP');
        $isfirstsee = "isfirstsee";
        $cookie_value = "no";
        setcookie($isfirstsee, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
        //echo "tttt1";
        
        echo '<script>
                jQuery(function($){
                    $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: 0,
                        text: "Choose the delivery location"
                    }));
                    $(".modal-dialog_swicher_shipping_parsa #billing_country  option[value=0]").attr('selected',true);
                    $("a.shipToLink.clickaction").click();
                });
        </script>';
    }
    echo '<script>
            jQuery(function($){
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "all",
                        text: "All Countries"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "DE",
                        text: "Germany"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "NL",
                        text: "Netherlands"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "CA",
                        text: "Canada"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "GB",
                        text: "United Kingdom (UK)"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "US",
                        text: "United States (US)"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "my",
                        text: "My Top 5 Countries"
                    }));                
            });
    </script>';
    //global $WOOCS;
    //$WOOCS->set_currency('GBP');
    error_reporting(0);
}

Thanks