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("Make sure you read Terms & Agreement");
    Shopify.Cart.Tacc.checkboxes['480'] = false;
    Shopify.Cart.Tacc.alerts['480'] = "You must agree with the terms and conditions of sales to check out.";
    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-480') !== -1) {
            toSkip = true;
          }
        })
        if(!toSkip) {
          places.push(toAdd);
        }
      });
    setTimeout(function(){
          if(places.length > 0) {
            jQuery.each(places, function() {
              jQuery(this).before('<div class="checkbox-480"><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-480" data-terms-id="480" onclick="Shopify.Cart.Tacc.toggle(this, 480, \'Make sure you read Terms & Agreement\');" /><a target="_blank" href="https://www.shopsandispells.com/pages/shipping-policies">I agree with the terms and conditions</a></label></p><style>.checkbox-480 label.checkox-label-st a { text-decoration: none; color: #9f5a15; }</style></div>');
            });
            Shopify.Cart.Tacc.syncState(480);
          }
        }, 0);
      }, 500);
    };
    } }
