Skip to content

MultiAdd: Multiple groups of variant radio buttons in a template #13

@wileykoepp

Description

@wileykoepp

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:

  1. Find a way to have MultiAdd work with matching/grouped name attributes
  2. 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 %}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions