We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How do I hide the 'Buy Now' option for specific products

Solved

How do I hide the 'Buy Now' option for specific products

lukafernada
Pathfinder
157 2 57

I need to hide the "Buy Now" options for the product pages of my kitchen knives, because it allows the user to bypass age verification in the cart. How do I do this. I am referring to this option here: 

Image 07-10-2024 at 13.18.jpeg

Accepted Solution (1)
lukafernada
Pathfinder
157 2 57

This is an accepted solution.

Never mind i fixed it:

Screenshot 2024-10-07 at 14.51.43.png

thank you

View solution in original post

Replies 5 (5)

rajweb
Shopify Partner
845 71 161

Hi @lukafernada ,

Follow these steps:

 

    • Go to your Shopify Admin > Products.
    • For each kitchen knife product, add a unique tag like age-verification or no-buy-now.
      • In the product edit screen, find the Tags section.
      • Enter the tag no-buy-now and click Save.
  • Edit the Product Template:

    • Go to Online Store > Themes > Edit code.
    • In the left sidebar, find the product template file (product.liquid or main-product.liquid), which typically controls the layout of the product page.
  • Add Conditional Logic to Hide the Buy Now Button:

    • In the product template file, find the section of code that renders the "Buy Now" or dynamic checkout button. It may look like this:

 

{{ form | form | dynamic_checkout_button }}

 

  • Add the following conditional logic to hide the button for products with the no-buy-now tag:

 

{% unless product.tags contains 'no-buy-now' %}
  {{ form | form | dynamic_checkout_button }}
{% endunless %}
​

 

  • This code checks whether the product contains the no-buy-now tag. If it doesn't, the "Buy Now" button will be shown. If the product has the tag, the button will be hidden.

 

Rajat | Shopify Expert Developer
Need a reliable developer for your next Shopify project? Let's connect!
Email: rajat.shopify@gmail.com
Portfolio: rajatweb.dev
Your one-stop partner for Shopify development, SEO, and performance. Let’s grow your store together!
lukafernada
Pathfinder
157 2 57

Doesn't let me save? Is this in the right place?

Screenshot 2024-10-07 at 14.31.46.png

lukafernada
Pathfinder
157 2 57

This is an accepted solution.

Never mind i fixed it:

Screenshot 2024-10-07 at 14.51.43.png

thank you

WalkYourStyle
Navigator
475 58 79

Do you want to hide the button only for kitchen knives, or would you prefer the flexibility to hide it for any product of your choice?
Could you please share your store's URL in the meantime?

lukafernada
Pathfinder
157 2 57

yes any product of my choice preferably, 

cheffings.net is the URL