All things Shopify and commerce
First off I'm using the Sense theme and everything that I've been finding I can't find the specific code to allow me to do it. or it hasn't worked.
I'd like to be able to remove the add to cart and the quantity off of specific product pages but leave the rest alone. I'm not horrible with code but by no means am I a genius either. Any help would be appreciated.
Solved! Go to the solution
This is an accepted solution.
Hi @carriemek
Do you need this only on product pages or on whole website like category pages, homepage etc?
I did this with a trick. I added a tag to all those products where I don't need quantity and add to cart button.
Then, I modified the code in a way if that tag is available on the product hide quantity and add to cart button.
Note: my tag for this condition is 'catalog'
Hidden both
Normal product
To achieve this, you should open main-product.liquid under Sections.
Then find buy_buttons
Replace below code
{%- when 'buy_buttons' -%}
{%- render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true -%}
and paste below code
{%- when 'buy_buttons' -%}
{% unless product.tags contains 'catalog' %}
{%- render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true -%}
{% endunless %}
See below picture for better clarity.
This is fixed for Add to cart button.
Now, let's move to quantity.
Search for " when 'quantity_selector' "
Paste below line after when 'quantity_selector'
{% unless product.tags contains 'catalog' %}
Like this
Now find next " when " condition. I've " when 'popup' "
Now, paste {% endunless %} just before this " when 'popup' " as shown in above image.
That's it. You did it.
Let me know if this solves you query.
Thanks
Sheesh B
This is an accepted solution.
Hi @carriemek
Do you need this only on product pages or on whole website like category pages, homepage etc?
I did this with a trick. I added a tag to all those products where I don't need quantity and add to cart button.
Then, I modified the code in a way if that tag is available on the product hide quantity and add to cart button.
Note: my tag for this condition is 'catalog'
Hidden both
Normal product
To achieve this, you should open main-product.liquid under Sections.
Then find buy_buttons
Replace below code
{%- when 'buy_buttons' -%}
{%- render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true -%}
and paste below code
{%- when 'buy_buttons' -%}
{% unless product.tags contains 'catalog' %}
{%- render 'buy-buttons', block: block, product: product, product_form_id: product_form_id, section_id: section.id, show_pickup_availability: true -%}
{% endunless %}
See below picture for better clarity.
This is fixed for Add to cart button.
Now, let's move to quantity.
Search for " when 'quantity_selector' "
Paste below line after when 'quantity_selector'
{% unless product.tags contains 'catalog' %}
Like this
Now find next " when " condition. I've " when 'popup' "
Now, paste {% endunless %} just before this " when 'popup' " as shown in above image.
That's it. You did it.
Let me know if this solves you query.
Thanks
Sheesh B
Thank you for responding, I did exactly what you said and I found all the places( your pics where helpful) It saved but nothing changed? I can send screenshots
ok I think i actually got it to work thank you so much!
Hi @carriemek
I think you missed to add the tag to product but glad you got it.
Kindly accept the answer if you found it working so that others can take benefit as well if they encounter something like this.
Thanks
Sheesh B
User | RANK |
---|---|
43 | |
40 | |
24 | |
24 | |
22 |
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023