how to remove "buy it now" on brooklyn theme product page for sold out items

Solved
Highlighted
Tourist
11 0 0

Hello everyone, 

I am using brooklyn theme and im trying to figure out how to get "Dynamic Checkout Button" on Product Page to show "Buy it now" on products that have stocks and removing the button on products without stocks. 

 

basically, if item is sold out it should only show "sold out." right now it's showing both "sold out" and "buy it now" for me, unless i un-check "show dynamic checkout button".

Does anyone have had this problem before? please let me know how i could remove the "buy it now" even with the dynamic checkout button checked as i would like both "add to cart" and "buy it now". 

thanks!

0 Likes
Highlighted
Shopify Partner
1279 169 401

This is an accepted solution.

Easy fix. Go into your product-template.liquid in your sections folder and locate this piece of code:

 

buy_button.jpg

 

Just add the condition "and product.available":

{% if section.settings.enable_payment_button and product.available %}
   {{ form | payment_button }}
{% endif %}
If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
Highlighted
Tourist
11 0 0

It works! Thanks a lot, appreciate it. 

0 Likes
Highlighted
Tourist
3 0 0

Could you let me know how to remove the buy it now button without having to uncheck the dynamic section?  I have added code for an upload file, but want to make the buy it now button gone.  Just for this product not for all products...any ideas?  Thank you!

0 Likes
Highlighted
Shopify Partner
1279 169 401

You can check the product handle and use an unless statement. So lets say you have a product called Blue Tea Cup  you could do:

{% if section.settings.enable_payment_button and product.available %}
  {% unless product.handle == 'blue-tea-cup' %}
     {{ form | payment_button }}
  {% endunless %}
{% endif %}
If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
1 Like
Highlighted
Tourist
3 0 0
Thank you so much! If I am going to be applying this to multiple products
so for example 8.5x11 Custom Photo Puzzle and then I have a 4x6 Custom
Photo Puzzle would I need to write this for every instance? Or could I
just use "custom photo puzzle" in the line and that would pick up anything
with that leaving out the size variable?

Many thanks!
Jaime
0 Likes
Highlighted
Shopify Partner
1279 169 401

It would have to be the handle of the product. A different way to approach this would be to make a switch statement at the top of the product page to test for the product handle and set a variable to true if it matches the conditions. So let's user Blue Tea Cup, Red Tea Cup, and Green Tea Cup as an example:

 

{% assign hide_payment_button = false %}
{% case product.handle %}
  {% when 'blue-tea-cup' %}
    {% assign hide_payment_button = true %}
  {% when 'red-tea-cup' %}
    {% assign hide_payment_button = true %}
  {% when 'green-tea-cup' %}
    {% assign hide_payment_button = true %}
{% endcase %}

{% if section.settings.enable_payment_button and product.available %}
  {% unless hide_payment_button %}
     {{ form | payment_button }}
  {% endunless %}
{% endif %}

 

Or, another way would be to tag the products that you don't want to show the payment button. Say you tag the products "hide payment options":

 

{% if section.settings.enable_payment_button and product.available %}
  {% unless product.tags contains "hide payment options" %}
     {{ form | payment_button }}
  {% endunless %}
{% endif %}

 

 

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
1 Like
Highlighted
Tourist
3 0 0
That worked swimmingly, thank you so much!!
0 Likes