Dawn Theme: Looking to remove quantity selector from cart for a specific collection only

I am building a site for a client and I am looking to remove the quantity selector from the cart page for a specific collection only.

Any suggestions?

You’ll want to go into your main-cart-items.liquid file in your sections folder and open it up. Ctrl + F and search for “quantity__button”. It’s about line 154.

You’re going to want to make a condition above the “quantity-input” element that loops through the collections that the current product in the loop is a part of. and assign a variable to be true if it’s handle matches the collection you want to hide it from. Then wrap the input buttons in unless conditions so they only appear if the variable is true, and write an if statement to display a “readonly” attribute for your quantity input so that people can’t change it by typing

Here’s the code for the element, you should be able to just replace that element in your code with this new code, and you can swap out the “your-collection-handle” for your actual collection handle:

{% assign disable_quantity_buttons = false %}
                    {% for collection in item.product.collections %}
                    {% assign collection_handle = collection.title | handleize %}
                    {% if collection_handle == 'your-collection-handle' %}
                    {% assign disable_quantity_buttons = true %}
                    {% endif %}
                    {% endfor %}
                    
2 Likes

Thank you Ninthony! I will try this and let you know how it works out.

Hi Ninthony! Do you know how I would go about renaming the quantity button to say “Days” Instead of Quantity? I run a rental business and would need it to reflect the number of days a renter requests.

For the cart page it’s in main-cart-items.liquid in your sections folder at about line 39:

Ninthony_0-1634924911428.png

Just ctrl + f and search for “cart-items__heading” and you should find it.

On the product page it’s in main-product.liquid in your sections folder. Its at line 135:

Thank you so much @Ninthony this solution worked like a charm!

Hello! I’m hoping you could help me with something quickly, too :slightly_smiling_face: I want the cart checkout bubble to have a little checkmark instead of a number (so people know there is something in there, but not necessarily a quantity.) This is because right now, I’m doing a rental and the quantity reflects the number of DAYS vs. the number of items and I feel like it’s confusing (people think they will be getting 4 lifejackets perhaps). There is a picture below of what I mean…

Thank you so much!

Thanks @Ninthony u rocks! Do you know how i could remove the “cart-remove-button” for the same specific collection? :folded_hands:t3: :folded_hands:t3: :folded_hands:t3: