Created
February 13, 2018 00:24
-
-
Save gterrill/4d4d090bc2ecbc9160c9669eb89e8bc7 to your computer and use it in GitHub Desktop.
Make quantity read only for the Empire theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if has_items %} | |
<script> | |
document.addEventListener("DOMContentLoaded", function(event) { | |
{% for item in cart.items %} | |
$('.cart-item--quantity:nth-child({{ forloop.index }})') | |
.empty() | |
.append({{ item.quantity }}) | |
.append('<input type="hidden" value="{{ item.quantity }}" name="updates[]" id="updates_{{ item.key }}">'); | |
{% endfor %} | |
}); | |
</script> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this code to the end of the sections/static-cart.liquid file