Need a little help with code on product page

Solved
Highlighted
Tourist
4 0 1

Hello amazing people! I'm Alex! I've run into an issue with my product page and I hope you can help me a little!

I have some rudimentary HTML knowledge, but I couldn't get it to work.

 

Basically, I wanted to change the quantity picker from number based to drop-down based. So, the code initially looked like this:

 

{% if section.settings.show_quantity_selector %}
              <div class="product-form__controls-group">
                <div class="product-form__item">
                  <label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>
                  <input type="number" id="Quantity-{{ section.id }}"
                    name="quantity" value="1" min="1" pattern="[0-9]*"
                    class="product-form__input product-form__input--quantity" data-quantity-input
                  >
                </div>
              </div>
            {% endif %}

 

 

And after I modified it it looked like this:

 

{% if section.settings.show_quantity_selector %}
              <div class="product-form__controls-group">
                <div class="product-form__item">
                  <label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>
                  <select name="Number of Products" id="Quantity-{{ section.id }}" class="product-form__input product-form__input--quantity" data-quantity-input>
  					<option value="1">1</option>
  					<option value="2">2 - GET 1 FREE! (Best Value)</option>
  					<option value="3">3</option>
				  </select>
                </div>
              </div>
            {% endif %}

 

And it's not working.

Could you tell me what I'm missing? Thank you anticipated!

0 Likes
Highlighted
Shopify Partner
68 6 14

Hi @alexlaslau , welcome to the community forums!

When you say it's not working, can you describe what you think it should be displaying and what it is displaying instead? Are there any messages in your console?

 

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
0 Likes
Highlighted
Excursionist
25 6 5

This is an accepted solution.

I think your SELECT element's name attribute needs to be "quantity" instead of "Number of Products". Give this a try and let us know if you see any improvement.

<select name="quantity" id="Quantity-{{ section.id }}" class="product-form__input product-form__input--quantity" data-quantity-input>

 

2 Likes
Highlighted
Shopify Partner
68 6 14

@Winbox this worked for me! Nice one

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
1 Like
Highlighted
Excursionist
25 6 5

That's great to hear that it's working!

Cheers!

0 Likes
Highlighted
Tourist
4 0 1

It worked, the name "quantity" works. Thank you so much!

1 Like