Comment to 'How to disable Countries without deleting them?'
  • It seems I found the easiest variant. Go to the Studio->Pages->[necessary module]->[Necessary page] and add there the RAW block with the following content:

    <script language="javascript">

     $(".bx-form-input-location-country option[value!='US']").remove();

    </script>

    • Ok. Thank you very much. I am going to give it a try and let you know. Now my question is instaed of adding it on a page per page basis, isn't there a way to add it globably? Maybe through main header injection? (just asking).

      Also what about if I would like to leave visible 3 countries: US, CA, UK, the code above should be like this, right?

      $(".bx-form-input-location-country option[value!='US, CA, UK']").remove();

      Please correct me if I am wrong. Thanks

      • No, it would be much different. Go to the Studio->Designer->Injections->Head injection area and place there the following code:

        <script language="javascript">

        $(document).ready(function() {

          var oField = $(".bx-form-input-location-country");

        $.each(['GB', 'CA', 'US'], function( iIndex, sValue ) {

           oField.find("option[value='" + sValue + "']").val("---" + sValue);

          });

          oField.find("option:not([value^='---'])").remove();

          oField.find("option").each(function(){

           var sNew = $(this).val();

           $(this).val(sNew.replace('---', ''));

          });

        });

        </script>