Hi ![]()
i would like to hide the quantity selector for free products with 0,00€
Can somebody help pls?
A Shopify store owner wants to hide the quantity selector for free products (priced at €0.00) on their cart page.
Solution provided:
{% if item.original_line_price > 0 %} before <quantity-input> and {% endif %} after itsnippets/cart-drawer.liquid (around the <quantity-input> element)sections/main-cart-items.liquid (same conditional logic)Implementation challenges:
<quantity-input> instead of <quantity-popover>)Resolution: Issue successfully solved after applying the conditional code in both required theme files. Free products now display without quantity selectors throughout the cart experience.
Hi ![]()
i would like to hide the quantity selector for free products with 0,00€
Can somebody help pls?
Since your site is on Shopify, to hide the quantity selector for products priced at 0,00€, you can achieve this by modifying your theme’s code. Here’s how you can do it:
Go to Themes:
Locate the Product Template:
Add Conditional Logic: Find where the quantity selector is rendered in the code, which might look something like:
liquid
Copy code
{% if product.requires_quantity %} <input type=“number” class=“quantity” … /> {% endif %}
You can wrap this with a condition to check the product price:
liquid
Copy code
{% if product.price > 0 %} <input type=“number” class=“quantity” … /> {% endif %}
This will ensure that the quantity selector only appears if the product price is greater than 0,00€.
Save the Changes: After adding the code, save the changes.
Test the Change: Check your product pages to ensure that the quantity selector is hidden for free products and still visible for those with a price.
If you’re using Shopify Plus, you can leverage Shopify Scripts to manage more advanced customizations, like hiding certain elements based on price.
Hi ![]()
thanks! But i cant find the correct selcetor in the code
Step 1: Navigate to your Shopify admin panel and go to “Online Store.”
Step 2: Click on “Themes” and then select Edit code
Step 3: Find snippets/cart-drawer.liquid line
281 for dawn theme and search before it add {% if item.original_line_price > 0 %}
and after add
{% endif %}
it will solve your issue.
Let me inform is that ok for you.
Hi ![]()
thanks, but there is no "" Maybe somehting different?![]()
In that case search <quantity-input it must exits
Put the first code before it {% if item.original_line_price > 0 %} <quantity-input like this and also after it
{%- endif -%}
it will solve
thank you
Yes, please insert at the end of that tag also
thanks it worked! But now if im in the cart page, it will be automatically removed after some seconds
You can check here: https://pepelini.de/products/pengi-bundle
Can you check after restore the code, just the issue occurred or not. What I understand your app or any other login ended the card item again and remove that.
yes i checked, there was a problem with another app. Now it stays, but you can increase he amount on the cart page. I would like to remove it from there also.
Please sections/main-cart-items.liquid edit the file and add the same code like my screen shot. it will solve your issue
Please do not forget to accept the solution as solved and like our solution.
Thank you
thanks it worked! But if i go to checkout and then go back, then its again possible to select the quantity.
Hello, @LinisCandy
You made mistake the product oder is chagned , the 00 price product has not quantity selector ![]()
Hi ![]()
sorry! you are right. Many many thanks for your great help really appreciate it!