Skip to content

Instantly share code, notes, and snippets.

@gterrill
Created February 13, 2018 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gterrill/4d4d090bc2ecbc9160c9669eb89e8bc7 to your computer and use it in GitHub Desktop.
Save gterrill/4d4d090bc2ecbc9160c9669eb89e8bc7 to your computer and use it in GitHub Desktop.
Make quantity read only for the Empire theme
{% 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 %}
@gterrill
Copy link
Author

Add this code to the end of the sections/static-cart.liquid file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment