The concept I would like to make is to sell products in single copy (That is to say only one copy per product).
I have a problem with the variants. I would like to offer my customers to choose the size of their product however, if I put variants of sizes, for example 5 sizes, there is no longer a single product but 5 so it is not at all the same concept.
So my question is: Is there a solution so that once the size chosen, the product is sold out even if there are other variants?
I asked to Chatgpt some code to do that but I don’t know where to put them in the code pf my store.
here are the code I have from Chatgpt :
{% assign sizes_inventory = {} %}
{% for variant in product.variants %}
{% assign sizes_inventory[variant.option1] = variant.inventory_quantity %}
{% endfor %}
Sélectionnez la taille :
Acheter