remove quantity box from some product pages but not all

leslyejoy
New Member
4 0 0

Is it possible to remove the quantity box from some product pages but not others? Some of my products are sold in predetermined sets at a price for the whole set, e.g., 25 @$75 total, 50@$100 total, etc. I have set up a dropdown menu using variants, so I do not want the quantity box on those pages. But other products are sold at just one price regardless of quantity, so I want the quantity box on those pages. Thanks for any assistance!

0 Likes
Bill_3five
Shopify Expert
29 0 10

Are you currently using product 'tags' for anything?  I would suggest adding a tag of 'set' to products that come in a set and you don't want the quantity box displayed.

On the product.liquid template, replace this code:

<div style="display: inline;" class="select">
		<label for="quantity">quantity</label>
		<input type="number" value="1" id="quantity" name="quantity" class="quantity" size="2" min="1">
	</div>

 

With this code:

{% unless product.tags contains 'set' %}
	<div style="display: inline;" class="select">
		<label for="quantity">quantity</label>
		<input type="number" value="1" id="quantity" name="quantity" class="quantity" size="2" min="1">
	</div>
{% endunless %}

 

mistralchem
Excursionist
16 0 35

Alternatively, you could set up a second liquid template for those types of product, eg. product.noqty.liquid.

Copy in the html for product.liquid and change it so that the qty box is hidden and qty is set to 1 via a hidden field.

You will then be given a new option on your product admin pages.  There will be a dropdown called Template where you can assign the products in question to the product.noqty.liquid template and they will always display using the format in that file.  All other products will continue to display normally according to the product.liquid template file.

Tony
0 Likes
leslyejoy
New Member
4 0 0

Thanks for the replies! Shortly after I wrote the post, I found out about creating alternative templates as mistralchem suggests and went with that solution. In doing that I was able to selectively remove the quantity box for some products and also to reword how the price appeared at the top of those product pages, to indicate the price was for a set. It's been working fine.

0 Likes