Answers.Body: <p>The <code>name</code> for your input needs to be <code>purchasableId</code>:</p>
  
  <pre><code>{% for digitalProduct in entry.exampleProducts.all() %}
    &lt;li&gt;
      &lt;div&gt;
        &lt;input 
          type="radio"
          name="purchasableId"
          value="{{digitalProduct.purchasableId}}" /&gt;
      &lt;/div&gt;
    &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-05T00:48:13.043Z
Answers.LastActivityDate: 2019-10-05T00:48:13.043Z
Answers.UserDisplayName: Stephen Callender
Body: <p>I'd like to add a digital product to the cart using a radio input but all the template examples I see use select. Is it possible to use a radio input?</p>
  
  <p><strong>With Select (working):</strong></p>
  
  <pre><code>&lt;select name="purchasableId"&gt;
    {% for digitalProduct in entry.fontProducts.all() %}
      &lt;option value="{{digitalProduct.purchasableId}}"&gt;{{digitalProduct.slug}}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>With radio inputs (not working):</strong></p>
  
  <pre><code>{% for digitalProduct in entry.exampleProducts.all() %}
    &lt;li&gt;
      &lt;div&gt;
        &lt;input 
          type="radio"
          name="product"
          value="{{digitalProduct.purchasableId}}" /&gt;
      &lt;/div&gt;
    &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
Tags: <plugin-craftcommerce2><ecommerce><plugin-digitalproducts>
Title: Is it possible to add to cart with a radio input rather than a select?
ThreadText: # Is it possible to add to cart with a radio input rather than a select?
  
  (Asked by: username_0 on 2019-10-04)
  
  I'd like to add a digital product to the cart using a radio input but all the template examples I see use select. Is it possible to use a radio input?
  
  **With Select (working):**
  
  ```
  <select name="purchasableId">
    {% for digitalProduct in entry.fontProducts.all() %}
      <option value="{{digitalProduct.purchasableId}}">{{digitalProduct.slug}}</option>
    {% endfor %}
  </select>
  
  ```
  
  **With radio inputs (not working):**
  
  ```
  {% for digitalProduct in entry.exampleProducts.all() %}
    <li>
      <div>
        <input 
          type="radio"
          name="product"
          value="{{digitalProduct.purchasableId}}" />
      </div>
    </li>
  {% endfor %}
  
  ```
  
  **Tags:** plugin-craftcommerce2, ecommerce, plugin-digitalproducts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-05. Score: 2 | Accepted answer
  
  The `name` for your input needs to be `purchasableId`:
  
  ```
  {% for digitalProduct in entry.exampleProducts.all() %}
    <li>
      <div>
        <input 
          type="radio"
          name="purchasableId"
          value="{{digitalProduct.purchasableId}}" />
      </div>
    </li>
  {% endfor %}
  
  ```
  
  
  ---
  
  