Show title and image of all Shopify products within drop down menu

I'm working on a "bundling" feature for my store and would like to show all my products within a custom form field.

I would like there to be a dropdown menu showing the title and primary image for each product.

I'm thinking the code should be something like this:

<p class="line-item-property__field">
  <label>bundled item</label><br>
  <select required class="required" id="bundled-item" name="properties[bundled item]">
    {% for product in collections.products %}
      <option value="{{ product.title }}">{{ product.title }}{{ product.featured_image }}</option>

    {% endfor %}
  </select>
</p>

Answers


Try this

    {% for product in collections['all'].products %}
      <option value="{{ product.title }}">{{ product.title }}{{ product.featured_image }}</option>
  {% endfor %}

But remember, only a maximum of 1000 items can be called in a loop; by default it is 50.


Need Your Help

Action Filters + AspNetRedisProvider

c# asp.net asp.net-mvc-4 redis

Hi i am currently implementing this provider "https://github.com/kylesonaty/AspNetRedisProviders" for an application i am currently working on in asp.net mvc4. However things are not as rosy as i