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>
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025