Because it is a simple (but complete) solution, it's posted here.
This is an updated code for V4.1.0.0 so the first value (in order) would be the default one
Pay attention this is a temporary workaround to solve the problem, as any OC update could reset this code !
There is 3 type of option that I wanted default value :
- radio
- checkbox
- select
For the radio I replace
Code: Select all
<input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" id="input-option-value-{{ option_value.product_option_value_id }}" class="form-check-input"/>
Code: Select all
<input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" id="input-option-value-{{ option_value.product_option_value_id }}" class="form-check-input"
{% if loop.first %}checked{% endif %} />
Code: Select all
<input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" id="input-option-value-{{ option_value.product_option_value_id }}" class="form-check-input"/>
Code: Select all
<input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" id="input-option-value-{{ option_value.product_option_value_id }}" class="form-check-input"
{% if loop.first %} checked {% endif %} >
Code: Select all
<option value="{{ option_value.product_option_value_id }}">{{ option_value.name }}
Code: Select all
<option value="{{ option_value.product_option_value_id }}" {% if loop.first %}selected{% endif %}> {{ option_value.name }}
