No Javascript on form-cart.liquid?

New Member
1 0 0

We are having a strange behaviour with custom attributes and Javascript on the form-cart.liquid template:


We added an additional delivery-date field with a slightly more complicated calculation of the available days in JS - as suggested in some blog posts in this forum - and are adding the select options to the attribute select field with jquery.


<select id="delivery-date" name="attributes[delivery-date]">
  <option value="">lieferdatum wählen</option>
var selectBox = $('#delivery-date'); var toAppend = '<option value="' + nextDelivery[index].name + '">' + nextDelivery[index].label + '</option>'; selectBox.append(toAppend); ...

But some users (all kind of browsers) are not able to choose an option from the select field. So we have added two more custom attributes to detect, if JS at all and Jquery is available.

    <input type="hidden" id="browsername" name="attributes[browser]" value="">
    <input type="hidden" id="hasjquery" name="attributes[hasjquery]" value="no">
<script type="text/javascript">
  (function() {
document.getElementById('browsername').value = navigator.userAgent; })(); </script> <script type="text/javascript"> (function() { if (window.jQuery) { document.getElementById('hasjquery').value = 'yes'; } else { document.getElementById('hasjquery').value = 'no - but js'; } })(); </script>

When users can't choose a delivery day, they don't even have JS on the cards page. But as far as we can see, many parts of the shop (e.g. the checkout button) only work with Javascript.

Did someone else discover the problem?
Any ideas? Thank you so much for your help...