Replace "Add to Cart" and "Buy it Now" buttons IF product price == 0

I am a newbie using the Dawn theme. I have not found any place in the code-behind to replace the “Add to Cart” and “Buy it Now” buttons on the individual product page IF product.price == 0 with a phone number (xxx) xxx-xxxx.

Hello @HappySunflower
it needs to modify product-template.liquid file of your theme to apply this condition.

Hey @niraj_patel ,

Thanks for your quick reply. I searched for “product-template.liquid”, and it does not seem to exist.

Do you mind elaborating on the “how” part?

Hello @HappySunflower
on Dawn theme inside sections you find a section named “main-product.liquid” inside this file please find and apply condition above this line

Hi,
In the file main-product.liquid, you can search for ‘product-form__buttons’ where you will find buttons code and you can write you custom code condition there
I hope the above is useful to you.
Thanks!

The string does not exist in “main-product.liquid”.

In the file main-product.liquid, the string ‘product-form__buttons’ does not exist.

The solution was to open “main-product.liquid” and search for {%- when ‘buy_buttons’ -%}

I could then add boolean logic.

I also needed to hide the quantity by searching for {%- when ‘quantity_selector’ -%}