Hide Quantity Selector for free products

Solved

Hide Quantity Selector for free products

LinisCandy
Explorer
82 2 11

Hi 🙂

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

Can somebody help pls?

www.pepelini.de

Bildschirmfoto 2024-09-23 um 12.18.57.png

Accepted Solution (1)
LinisCandy
Explorer
82 2 11

This is an accepted solution.

thanks it worked! But if i go to checkout and then go back, then its again possible to select the quantity.

Bildschirmfoto 2024-09-24 um 10.54.36.pngBildschirmfoto 2024-09-24 um 10.54.44.png

View solution in original post

Replies 17 (17)

waqaskh12
Tourist
5 1 1

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 Shopify

  1. Log in to your Shopify Admin: Go to your Shopify admin dashboard.

  2. Go to Themes:

    • Navigate to Online Store > Themes.
    • Click on Actions next to your current theme, and select Edit code.
  3. 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).
  4. 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€.

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

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

LinisCandy
Explorer
82 2 11

Hi 🙂

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

Arif_Shopidevs
Shopify Partner
521 44 93

@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 <quantity-popover> before it add  {% if item.original_line_price > 0 %}

and after </quantity-popover> add 
{% endif %}
it will solve your issue.

Arif_Shopidevs_0-1727089858016.png


Let me inform is that ok for you.

 

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

Hi 🙂

thanks, but there is no "<quantity-popover>"  Maybe somehting different?:)

Bildschirmfoto 2024-09-23 um 13.15.01.png

Arif_Shopidevs
Shopify Partner
521 44 93

In that case search <quantity-input it must exits

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

Yes, yes, how should i put the code here then?:) Bildschirmfoto 2024-09-23 um 13.19.10.png

LinisCandy
Explorer
82 2 11

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

Bildschirmfoto 2024-09-23 um 13.19.10.png

Arif_Shopidevs
Shopify Partner
521 44 93

Put the first code before it  {% if item.original_line_price > 0 %}  <quantity-input like this and also after it

</quantity-input>  {%- endif -%}
it will solve

thank you

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

like here?:)

Bildschirmfoto 2024-09-23 um 13.34.48.png

Arif_Shopidevs
Shopify Partner
521 44 93

Yes, please insert at the end of that tag also 

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

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

Bildschirmfoto 2024-09-23 um 13.38.47.pngBildschirmfoto 2024-09-23 um 13.39.41.png

Arif_Shopidevs
Shopify Partner
521 44 93

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. 

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

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.

Arif_Shopidevs
Shopify Partner
521 44 93

Please sections/main-cart-items.liquid edit the file and add the same code like my screen shot. it will solve your issue

Arif_Shopidevs_0-1727110325786.png

Arif_Shopidevs_1-1727110388340.png



Please do not forget to accept the solution as solved and like our solution.

Thank you

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

This is an accepted solution.

thanks it worked! But if i go to checkout and then go back, then its again possible to select the quantity.

Bildschirmfoto 2024-09-24 um 10.54.36.pngBildschirmfoto 2024-09-24 um 10.54.44.png

Arif_Shopidevs
Shopify Partner
521 44 93

Hello, @LinisCandy 
You made mistake the product oder is chagned , the 00 price product has not quantity selector 🙂

 

Syncora: Backup & Restore [Free] - Automated real-time store backup with one-click easy restore.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery, and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers.

LinisCandy
Explorer
82 2 11

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