<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>

CC BY-SA 4.0
2019-10-05T00:48:13.043Z
2019-10-05T00:48:13.043Z
Stephen Callender
<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>

<plugin-craftcommerce2><ecommerce><plugin-digitalproducts>
Is it possible to add to cart with a radio input rather than a select?
# 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):

  {% for digitalProduct in entry.fontProducts.all() %}
    {{digitalProduct.slug}}
  {% endfor %}


With radio inputs (not working):
{% for digitalProduct in entry.exampleProducts.all() %}
  
    
      
    
  
{% 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() %}
  
    
      
    
  
{% endfor %}


---

