0

I'm outputting modifiers as radio field but how could I target the first modifier so that it is checked.

{modifier_options}
    <div class="large-6 columns">
        <label><input type="radio" name="{modifier_input_name}" checked="checked" value="{option_id}"/> {option_name} {if price_mod_val} ({price_mod}) {/if}</label>
    </div>
    {/modifier_options}

This selects the last modifier but would like it to be the first.

1 Answer 1

1

There is an option already for this in the docs: https://www.exp-resso.com/docs/product_tag.html#if_option_first

Thought I'd post the answer anyway.

{modifier_options}
    <div class="large-6 columns">
        <label><input type="radio" name="{modifier_input_name}" {if option_first}checked="checked"{/if} value="{option_id}"/> {option_name} {if price_mod_val} ({price_mod}) {/if}</label>
    </div>
{/modifier_options}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.