Shopify themes, liquid, logos, and UX
Any tips on referencing a product's metadata with JavaScript? I am trying to set customer limits to only order the Minimum Quantity defined in the product Metadata. I have been successful with all the liquid pages, just not pages where it is using JS which is the collection page.
Using the Trade Theme 15.0 with Bulk option on the collection page.
Please help!
{% if product.metafields.custom_fields.minimum_quantity %}
<script>
var minQuantity = {{ product.metafields.custom_fields.minimum_quantity | json }};
</script>
{% endif %}
<script>
function handleQuantityChange() {
var quantityInput = document.getElementById('quantityInput');
var currentQuantity = parseInt(quantityInput.value, 10);
if (minQuantity) {
if (currentQuantity < minQuantity) {
quantityInput.value = minQuantity;
}
}
}
</script>
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025