Hide Quantity Selector for free products

Topic summary

A Shopify store owner wants to hide the quantity selector for free products (priced at €0.00) on their cart page.

Solution provided:

  • Add conditional Liquid code wrapping the quantity selector: {% if item.original_line_price > 0 %} before <quantity-input> and {% endif %} after it
  • This code needs to be added in two locations:
    1. snippets/cart-drawer.liquid (around the <quantity-input> element)
    2. sections/main-cart-items.liquid (same conditional logic)

Implementation challenges:

  • Initial difficulty locating the correct code element (<quantity-input> instead of <quantity-popover>)
  • After first implementation, free items were auto-removing from cart (resolved - caused by conflicting app)
  • Quantity selector still appeared on checkout page when navigating back (resolved by applying code to both files)

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.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

Hi :slightly_smiling_face:

i would like to hide the quantity selector for free products with 0,00€

Can somebody help pls?

www.pepelini.de

1 Like

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:

Steps to Hide Quantity Selector for Free Products on Shopify1. Log in to your Shopify Admin: Go to your Shopify admin dashboard.

  1. Go to Themes:

    • Navigate to Online Store > Themes.
    • Click on Actions next to your current theme, and select Edit code.
  2. Locate the Product Template:

    • In the theme editor, under the Sections folder, look for product-template.liquid or main-product.liquid (the name can vary based on the theme).
  3. 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€.

  4. Save the Changes: After adding the code, save the changes.

  5. 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.


Alternative: Using Shopify Scripts (Shopify Plus)

If you’re using Shopify Plus, you can leverage Shopify Scripts to manage more advanced customizations, like hiding certain elements based on price.

Hi :slightly_smiling_face:

thanks! But i cant find the correct selcetor in the code

@LinisCandy

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.

1 Like

Hi :slightly_smiling_face:

thanks, but there is no "" Maybe somehting different?:slight_smile:

![Bildschirmfoto 2024-09-23 um 13.15.01.png|3774x2118](upload://nShUDkqgVd05otcXQMU5B4qA3vu.png)

In that case search <quantity-input it must exits

1 Like

yes, how should i put the code here then?:slight_smile:

Yes,yes, how should i put the code here then?:slight_smile:

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

1 Like

like here?:slight_smile:

Yes, please insert at the end of that tag also

1 Like

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.

1 Like

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

1 Like

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 :slightly_smiling_face:

1 Like

Hi :slightly_smiling_face:
sorry! you are right. Many many thanks for your great help really appreciate it!