You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to include multiple products in a template with variants in groups of radio buttons. The problem is that MultiAdd utilizes the name attribute of the input, making each name unique. Code snippet follows. I need to either:
Find a way to have MultiAdd work with matching/grouped name attributes
Find another way to group radio inputs while having name attributes with unique names
{% set itemsIndex = 0 %}
{% for product in entry.productType %}
{% for variant in product.variants %}
{% set itemsIndex = itemsIndex + 1 %}
<input type="hidden" name="items[{{ itemsIndex }}][purchasableId]" value="{{ variant.id }}">
<label class="radioLabel"><input type="radio" name="items[{{ itemsIndex }}][qty]" value="1"> {{ variant.title }}</label>
{% endfor %}
{% endfor %}
The text was updated successfully, but these errors were encountered:
Hmm, yeah that is a good point. Don't use radios myself as it happens. You could basically use a checkbox and some js to achieve the same I suppose, or some JS to manipulate the name of the checked thing before submitting the form, but that requires JS, and it's not ideal really.
We should have perhaps used a data-name type of thing eh @engram-design ? But sincew this was just a wee hack that grew into a now quite often and widely used thing, it would be a bit of a breaking change. Although we could implement it as a fallback perhaps?
What do you think Josh?
(Also there's a few commits etc. in master that really should be released, to do with the deprecated commerce db stuff....)
Trying to include multiple products in a template with variants in groups of radio buttons. The problem is that MultiAdd utilizes the name attribute of the input, making each name unique. Code snippet follows. I need to either:
The text was updated successfully, but these errors were encountered: