if(true) {
      // Add jquery if it is undefined
      if(!window.jQuery){
        let script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = '//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js';
        script.onload = function() {
          checkboxCreate();
        }
        document.head.appendChild(script);
      } else {
        checkboxCreate();
      }
      function checkboxCreate() {
        Shopify.Cart = Shopify.Cart || {};
        Shopify.Cart.Tacc = {};
        Shopify.Cart.Tacc.checkboxes = {};
        Shopify.Cart.Tacc.alerts = {};
        Shopify.Cart.Tacc.syncState = function(id) {
          var state = Shopify.Cart.Tacc.checkboxes[id.toString()];
          jQuery(`[data-terms-id="${id}"]`).each(function() {
            this.checked = state;
          })
        }
        Shopify.Cart.Tacc.toggle = function(checkbox, id, title) {
          if(checkbox.checked) {
            Shopify.Cart.Tacc.set(title);
            Shopify.Cart.Tacc.checkboxes[id.toString()] = true;
          } else {
            Shopify.Cart.Tacc.unset(title);
            Shopify.Cart.Tacc.checkboxes[id.toString()] = false;
          }
          jQuery(`[data-terms-id="${id}"]`).each(function() {
            this.checked = checkbox.checked;
          })
        }
        Shopify.Cart.Tacc.set = function(title) {
          var label = 'terms and conditions';
          if(title != null && title != '') {
            label = title;
          }
          var attributes = {};
          attributes['Accepted \'' + label + '\' checkbox'] = true;
          jQuery.ajax({
              type: 'POST',
              url: '/cart/update.js',
              data: { attributes: attributes },
              dataType: 'json'
          })
        }

        Shopify.Cart.Tacc.unset = function(title) {
          var label = 'terms and conditions';
          if(title != null && title != '') {
            label = title;
          }
          var attributes = {};
          attributes['Accepted \'' + label + '\' checkbox'] = false;
          jQuery.ajax({
              type: 'POST',
              url: '/cart/update.js',
              data: { attributes: attributes },
              dataType: 'json'
          })
        }

        Shopify.Cart.Tacc.reset = function(title) {
          var label = 'terms and conditions';
          if(title != null && title != '') {
            label = title;
          }
          var attributes = {};
          attributes['Accepted \'' + label + '\' checkbox'] = false;
          jQuery.ajax({
              type: 'POST',
              url: '/cart/update.js',
              data: { attributes: attributes },
              dataType: 'json',
              async: false
          })
        }

        jQuery('body').on('click', '[name="checkout"], [name="goto_pp"], [name="goto_gc"]', function(evt) {
          var messages = [];
          var submitForm = true;
          jQuery.each(Shopify.Cart.Tacc.checkboxes, function(key, value) {
            if(value == false) {
              submitForm = false;
              messages.push(Shopify.Cart.Tacc.alerts[key]);
            }
          })

          if(submitForm) {
            jQuery(this).submit();
          } else {
            evt.preventDefault();
            alert(messages.join("\n"));
            return false;
          }
        });
        jQuery('form[action="checkout"], form[action="/cart?locale=en"], form[action="/cart?locale=fr"]').on('submit', function(evt) {
          console.log('minicart submitted');
          var messages = [];
          var submitForm = true;
          jQuery.each(Shopify.Cart.Tacc.checkboxes, function(key, value) {
            if(value == false) {
              submitForm = false;
              messages.push(Shopify.Cart.Tacc.alerts[key]);
            }
          })

          if(!submitForm) {
            evt.preventDefault();
            alert(messages.join("\n"));
            return false;
          }
        });
      
    Shopify.Cart.Tacc.reset("Shipping terms");
    Shopify.Cart.Tacc.checkboxes['1716'] = false;
    Shopify.Cart.Tacc.alerts['1716'] = "Kindly review our Shipping / Returns page prior to finalizing your checkout. ";
    if(true) {
    setInterval(function() {
       var checkoutButtons = jQuery('[name="checkout"], [name="Checkout"], [value="checkout"], [value="Checkout"]');
        checkoutButtons = checkoutButtons.filter((button) => $(checkoutButtons[button])[0].localName == 'button' || $(checkoutButtons[button])[0].localName == 'input' );
      var places = [];
      jQuery.each(checkoutButtons, function(index, place) {
        var toAdd = place;
        var toSkip = false;
        var checkoutParent = jQuery(place).parent();
        jQuery.each(checkoutParent.children(), function(index2, child) {
          if(jQuery(child).attr('name') &&
            jQuery(child).attr('name').indexOf('update') !== -1){
            toAdd = jQuery(child);
          }
          if(child.classList.value.indexOf('checkbox-1716') !== -1) {
            toSkip = true;
          }
        })
        if(!toSkip) {
          places.push(toAdd);
        }
      });
    setTimeout(function(){
          if(places.length > 0) {
            jQuery.each(places, function() {
              jQuery(this).before('<div class="checkbox-1716"><p style="float: none; clear: both; margin: 10px 0;"><label class="checkox-label-st" style="display:inline; float:none; margin-left: 10px;"><input style="float:none; vertical-align: middle;" type="checkbox" id="terms-1716" data-terms-id="1716" onclick="Shopify.Cart.Tacc.toggle(this, 1716, \'Shipping terms\');" /><a target="_blank" href="https://shopnanin.com/pages/shipping-info-returns">Vintage items are final sale without exception.</a></label></p><style>.checkbox-1716 </style></div>');
            });
            Shopify.Cart.Tacc.syncState(1716);
          }
        }, 0);
      }, 500);
    };
    
    Shopify.Cart.Tacc.reset("Customer responsibility ");
    Shopify.Cart.Tacc.checkboxes['1717'] = false;
    Shopify.Cart.Tacc.alerts['1717'] = "Na Nin is not responsible for items that are lost, stolen or damaged in transit. We recommend that U.S. customers select the signature confirmation option during checkout for extra security on delivery. Thank you for supporting our growing small business!";
    if(true) {
    setInterval(function() {
       var checkoutButtons = jQuery('[name="checkout"], [name="Checkout"], [value="checkout"], [value="Checkout"]');
        checkoutButtons = checkoutButtons.filter((button) => $(checkoutButtons[button])[0].localName == 'button' || $(checkoutButtons[button])[0].localName == 'input' );
      var places = [];
      jQuery.each(checkoutButtons, function(index, place) {
        var toAdd = place;
        var toSkip = false;
        var checkoutParent = jQuery(place).parent();
        jQuery.each(checkoutParent.children(), function(index2, child) {
          if(jQuery(child).attr('name') &&
            jQuery(child).attr('name').indexOf('update') !== -1){
            toAdd = jQuery(child);
          }
          if(child.classList.value.indexOf('checkbox-1717') !== -1) {
            toSkip = true;
          }
        })
        if(!toSkip) {
          places.push(toAdd);
        }
      });
    setTimeout(function(){
          if(places.length > 0) {
            jQuery.each(places, function() {
              jQuery(this).before('<div class="checkbox-1717"><p style="float: none; clear: both; margin: 10px 0;"><label class="checkox-label-st" style="display:inline; float:none; margin-left: 10px;"><input style="float:none; vertical-align: middle;" type="checkbox" id="terms-1717" data-terms-id="1717" onclick="Shopify.Cart.Tacc.toggle(this, 1717, \'Customer responsibility \');" /><a target="_blank" href="https://shopnanin.com/pages/shipping-info-returns">I have read and agreed to the policies listed in Na Nin\'s Shipping / Returns page.</a></label></p><style>.checkbox-1717 </style></div>');
            });
            Shopify.Cart.Tacc.syncState(1717);
          }
        }, 10);
      }, 500);
    };
    } }
