How do I remove the "quantity," drop down on 1 specific product page?

New Member
9 0 0

How do I remove the "quantity," drop down on 1 specific product page?

I am currently marketing a product on facebook and so i created a custom drop down which offers discounts if they order 2 or 3 units.

It looks a bit weird to have a "quanity discount," drop down for quantity and then another "quantity," box next to that. I think it'll confuse people.  I'd like to remove the original quantity discount but can't figure it out. I've done research and I keep finding old posts ( 1 to 3 years old ) that I've tried in adjusting the code and it won't work.

Any other ideas?

0 Likes
Explorer
83 0 25

Hi Matt,

You can use an conditional statement to exclude it on whatever product you'd like. You can either use product.title, product.product_type, or product.vendor. You can also just create a new product template and remove the quantity there.

For example:

{% unless product.title == "All-In-One Universal Travel Adapter" %}
  // Quantity box code here
{% endunless %}

 

0 Likes
New Member
9 0 0

I appreciate the reply. Although I can plug in code directly where I'm directed, this is a little high level for me and I don't understand where to plug in what.  I believe I found the code in my theme (venture theme).  It looks like I found the area that would need to be edited under product-template.liquid. I see the following between lines 151 and 154

          <div class="product-form__item product-form__item--quantity">
            <label for="Quantity">{{ 'products.product.quantity' | t }}</label>
            <input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input product-form__quantity">
          </div>

I cannot tell what original code I would remove and where to plug in your suggested code:

{% unless product.title == "All-In-One Universal Travel Adapter" %} // Quantity box code here {% endunless %}

I've tried creating a new product template but not sure what to do from there.  Also, how did you know the product I was trying to do this for is the All-In-One Universal Travel Adapter?

0 Likes
Shopify Staff
Shopify Staff
519 33 72

Hi Matt, 

If you wanted to remove one of the drop-down menus from one particular product you would want try to remove one of that products variant options. 

To adjust the variants you would need to go into the product section of your store admin. Under the product that you are wanting to edit you need to scroll down to its 'Variant' section and click on 'Edit Options'. Under the edit section, you can delete the option that you don't want to have as a drop-down menu. 

I hope this helps to answer your question. If you have any other questions please feel free to reach out. Our support is here to help you out 24/7.

Cheers, 
Dallas
 

Dallas | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
New Member
9 0 0

That is true for all variant options except the quantity drop-down. Atleast in the venture theme that is not an option to delete. I've tried.

0 Likes
Explorer
83 0 25

Hi Matt,

I just chose the first product that came up when I went to your site and it happened to have the scenario you mentioned. The lines you posted in your comment above are where you'll want to put the code. So it should look like the below:

{% unless product.title == "All-In-One Universal Travel Adapter" %}
<div class="product-form__item product-form__item--quantity">
	<label for="Quantity">{{ 'products.product.quantity' | t }}</label>
	<input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input product-form__quantity">
</div>
{% endunless %}

 

0 Likes
New Member
9 0 0

it worked!! thank you.  last question. what would that code look like if I wanted to add other product pages in addition so they would also have quantity removed?  for example here is another product page title

ALL-IN-ONE MACBOOK PRO USB C HUB

0 Likes
Explorer
83 0 25

Hi Matt,

Glad I could help! You could just add it to the statement:

{% unless product.title == "All-In-One Universal Travel Adapter" or product.title == "All-in-One Macbook Pro USB C Hub" %}
<div class="product-form__item product-form__item--quantity">
	<label for="Quantity">{{ 'products.product.quantity' | t }}</label>
	<input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input product-form__quantity">
</div>
{% endunless %}

Or you can make an array containing your titles and use a forloop to go through the array and give the element a style to hide it:

{% assign titles = "All-In-One Universal Travel Adapter, All-in-One Macbook Pro USB C Hub" | split: ", " %}
<div class="product-form__item product-form__item--quantity" {% for title in titles %}{% if product.title == title %}style="display:none;"{% endif %}{% endfor %}>
  <label for="Quantity">{{ 'products.product.quantity' | t }}</label>
  <input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input product-form__quantity">
</div>

 

1 Like
Highlighted
New Member
9 0 0

Thank you again! I just switched theme from venture to Brooklyn. I cannot find where to paste the code you gave me earlier in this thread within the Product-template.liquid .  Is there somewhere else in the Brooklyn theme I can paste the below to hide the quantity box for my selected products?

Here is what you had me paste in which worked for venture

{% unless product.title == "All-In-One Universal Travel Adapter" or product.title == "All-in-One Macbook Pro USB C Hub" %}

Here is the code in the Venture theme I needed to paste the above code on top of.

<div class="product-form__item product-form__item--quantity"> <label for="Quantity">{{ 'products.product.quantity' | t }}</label> <input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input product-form__quantity"> </div> {% endunless %}

0 Likes
New Member
9 0 0

Thank you again Nick! I just switched theme from venture to Brooklyn. I cannot find where to paste the code you gave me earlier in this thread within the Product-template.liquid .  Is there somewhere else in the Brooklyn theme I can paste the below to hide the quantity box for my selected products?

Here is what you had me paste in which worked for venture

{% unless product.title == "All-In-One Universal Travel Adapter" or product.title == "All-in-One Macbook Pro USB C Hub" %}

Here is the code in the Venture theme I needed to paste the above code on top of.

<div class="product-form__item product-form__item--quantity"> <label for="Quantity">{{ 'products.product.quantity' | t }}</label> <input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input product-form__quantity"> </div> {% endunless %}

0 Likes