CHANGING BUY IT NOW BUTTON WHEN PRICE IS 0

Copy and paste this code wheen you want to change the text of the button to something else when the product is 0

{% comment %}
---------------------------------------------------------
Copyright © 2024 Ecomify Theme. All rights reserved.
Unauthorized copying, modification, distribution, or use
of this code or any portion of it, is strictly prohibited.
Violators will be prosecuted to the fullest extent of the law.
---------------------------------------------------------
{% endcomment %}


{% liquid 
    assign current_variant = product.selected_or_first_available_variant

    assign mt = block.settings.mt | prepend: 'mt-'
    assign mb = block.settings.mb | prepend: 'mb-'
%}

{%- if product.gift_card? -%}
    {%- render 'product-gift-card-form', form: form -%}
{%- endif -%}

{% if current_variant.price > 0 %}
  <div class="product-buy-buttons {{ mt }} {{ mb }}" {{ block.shopify_attributes }}>
      <div class="product-buy-buttons-inner {{ block.settings.qty_field_position | prepend: 'qty-position-' }}">
          {% if block.settings.show_qty_field %}
              <div class="quantity-wrapper me-3">
                  <button 
                      class="btn"
                      type="button"
                      data-mode="minus"
                      onclick="onClickQtyPlusMinus(this)" 
                      aria-label="{{ 'general.accessibility.decrease_qty' | t }}">
                      <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                          <line x1="5" y1="12" x2="19" y2="12"></line>
                      </svg>
                  </button>
                  <input
                      class="form-control" 
                      name="quantity"
                      type="text"
                      value="1"
                      data-min-qty="1"
                      aria-label="{{ 'product.quantity' | t }}">
                  <button 
                      class="btn btn-plus"
                      type="button"
                      data-mode="plus"
                      onclick="onClickQtyPlusMinus(this)"
                      aria-label="{{ 'general.accessibility.increase_qty' | t }}">
                      <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                          <line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line>
                      </svg>
                  </button>
              </div>
          {% endif %}
          <button
              class="btn-atc btn btn-primary w-100"
              type="submit"
              name="add"
              data-text-add-to-cart="{{ 'product.add_to_cart' | t }}"
              {% unless current_variant.available %}
                  disabled
              {% endunless %}>
              {% if current_variant.available %}
                  <span class="btn-atc-text">
                      {{ 'product.add_to_cart' | t }}
                  </span>
              {% else %}
                  <span class="btn-atc-text">
                      {{ 'product.sold_out' | t }}
                  </span>
              {% endif %}
              {% if block.settings.atc_btn_show_price %}
                  -
                  <span class="btn-atc-price">
                     {{ current_variant.price | money }}
                  </span>
              {% endif %}
          </button>
      </div>
      
      {% if block.settings.show_dynamic_buttons %}
          <div class="product-form-dynamic-buttons mt-5 pb-2">
              {{ form | payment_button }}
          </div>
      {% endif %}
      
      {% if block.settings.show_buy_btn or settings.wishlist_enable %}
          <div class="d-flex mt-4">
              {% if block.settings.show_buy_btn %}
                  <button 
                      class="btn-buy btn btn-sm btn-outline-secondary w-100 {% if settings.wishlist_enable %}me-2{% endif %}" 
                      type="button"
                      onclick="onClickBuyBtn(this, event)">
                      {{ 'product.buy_it_now' | t }}
                  </button>
              {% endif %}
              {% if settings.wishlist_enable %}
                  <button 
                      class="btn-wishlist-add-remove btn btn-sm btn-outline-secondary w-100 d-flex align-items-center justify-content-center {% if section.settings.form_show_buy_btn %}ms-2{% endif %}"
                      type="button"
                      data-product-handle="{{ product.handle }}"
                      data-text-add="{{ 'general.wishlist.add_to_wishlist' | t }}"
                      data-text-remove="{{ 'general.wishlist.remove_from_wishlist' | t }}"
                      aria-label="{{ 'general.wishlist.add_to_wishlist' | t }}"
                      onclick="addOrRemoveFromWishlist(this)">
                      <svg xmlns="http://www.w3.org/2000/svg" class="me-2" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                          <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
                      </svg>
                      <span>{{ 'general.wishlist.btn_label' | t }}</span>
                  </button>
              {% endif %}
          </div>
      {% endif %}
  </div>
{% else %}
  <a href="/pages/contact-us" class="btn btn-primary w-100">
    {{ 'product.get_a_quote' | t }}
  </a>
{% endif %}

at the bottom of the code, you can change this in the theme content area to change the text

{% else %}
  <a href="/pages/contact-us" class="btn btn-primary w-100">
    {{ 'product.get_a_quote' | t }}
  </a>
{% endif %}

Last updated