I want to show a select dropdown for product variations, but only if there are any in the first place. So I’ve looked at this part of the docs under “Showing product variations”, but in my case I want to hide the entire
div containing the
select input if there is only one product:
[[!commerce.get_products? &products=`[[+tv.products]]` &tpl=`product_select` ]] // product_select chunk: [[+total_products:eq=`1`:then=` <input type="hidden" name="product" value="[[+id]]"> `:else=` <div class="product-variation select-wrapper"> <label for="choose-variation">Option:</label> <select id="choose-variation" name="product"> <option value="[[+id]]">[[+name]]</option> </select> </div> `]]
Of course as of right now this doesn’t work as it gives me a individual dropdown for each option, but I don’t know how I can access every product on its own for the
Thanks for any help!