How do I add MOQ code to main-product.liquid

Hello, I’m trying to add the below code I found to add MOQ but I’m not sure where to paste it in. My theme has quite a few instances of quantity. I’m certainly a noob to this so any help would be greatly appreciated!

<span class="input-amount">
<label for="quantity" class="hidden">{{ 'product.form.quantity' | t }}</label>
<input type="number" id="quantity" name="quantity"
{% if product.tags contains "MIN4" and current_variant.inventory_management == 'shopify' -%}
value="4" min="4"
{% else %}}
value="1"
{% endif %}
{% if current_variant.inventory_management == 'shopify' and current_variant.inventory_policy == 'deny' -%}
max="{{ current_variant.inventory_quantity }}"
{% endif %} required>
</span>

With technical and code you must make an effort to be specific.

You must remember not everyone knows what your seeing, avoid ambiguity.

Not everyone has your theme or access to it, provide accessible urls, or code samples(do not paste giant walls of code).

In vague general terms quantity customizations require changing the product form.

For some themes start from the product template trace the sections and snippets to find the product form editing/replacing it’s existing quantity behavior.

For other themes use the form attribute to link the new inputs to the main product form while disabling the old quantity.

If you just need this customization created then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

Thank you Paul. Below is a link to my website where I’m hoping I can add an MOQ. Sorry for the lack of clarity in my initial post. The goal is to add an MOQ to this product (and all other products).

https://28cd87-a8.myshopify.com/products/style-01-ej5na-r3yz9

My assumption is that the code I need to edit is within this area, but I’m not sure where to paste/replace it. I’ve tried a few areas but none are having the expected result

{%- when 'quantity_selector' -%}

{% comment %} TODO: enable theme-check once `item_count_for_variant` is accepted as valid filter {% endcomment %}
{% # theme-check-disable %}
{%- assign cart_qty = cart
| item_count_for_variant: product.selected_or_first_available_variant.id
-%}
{% # theme-check-enable %}

That’s studio , based on the dawn theme

https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L255

Ignore the quantity_rule stuff if you not using B2B features of a shopifyPlus plan.

You may need to remove novalidate from the main form in buy-buttons snippet

https://github.com/Shopify/dawn/blob/main/snippets/buy-buttons.liquid#L51

Would this be a better script to use? I’m still not understanding where it needs to go:


This product requires a quantity of 4 minimum.

{% if product.tags contains "MIN4" %}

{% endif %}

You can go to your Online Store > Themes > Customize > Products, open product template you are using for your products, click Add block under Product information > choose Custom liquid, add code to Liquid code of block, drag and drop this block to place you want it display and Save template