Simple theme, call for pricing

Solved
Excursionist
18 1 0

On certain products we would like a "call for pricing" or any variance of such. Is there a way so if the product price is $0.00 it will default to "call for pricing?"

 

So far I was able to add "Call for pricing" adding a simple line of code below, but I would like to hide the price entirely as well. How can I achieve this?

 

1.JPG

2.JPG

0 Likes
Trailblazer
153 15 18

Hi @AS_Kits:

Which theme are you using? we need to see a little more of code.

Let's make the best store!
Contact us at: thepremierstores@gmail.com
0 Likes

Success.

Excursionist
18 1 0

Using the simple theme, hope this bit of code helps. Just trying to replace anything with a price of $0 to display some text instead...

 
         <p class="product-single__prices">
            {% if product.price == 0 %}
        		Call for price
            {% endif %}
            {% if product.compare_at_price_max > product.price %}
              <span id="ComparePriceA11y" class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
            {% else %}
              <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
            {% endif %}
            <span id="ProductPrice" class="product-single__price" itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
              {{ current_variant.price | money }}
            </span>

            {% if product.compare_at_price_max > product.price %}
              <span id="PriceA11y" class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
              <s class="product-single__price--compare" id="ComparePrice">
                {{ current_variant.compare_at_price | money }}
              </s>
            {% endif %}

            {% include 'product-unit-price', variant: current_variant, available: true %}
          </p>

          {%- if shop.taxes_included or shop.shipping_policy.body != blank -%}
            <div class="product-single__policies rte">
              {%- if shop.taxes_included -%}
                {{ 'products.product.include_taxes' | t }}
              {%- endif -%}
              {%- if shop.shipping_policy.body != blank -%}
                {{ 'products.product.shipping_policy_html' | t: link: shop.shipping_policy.url }}
              {%- endif -%}
            </div>
          {%- endif -%}

          {% form 'product', product, class:'product-form' %}
            <select name="id" id="ProductSelect-{{ section.id }}" class="product-single__variants">
              {% for variant in product.variants %}
                {% if variant.available %}
                  <option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
                {% else %}
                  <option disabled="disabled">
                    {{ variant.title }} - {{ 'products.product.sold_out' | t }}
                  </option>
                {% endif %}
              {% endfor %}
0 Likes
Excursionist
18 1 0

Using Simple Theme, hope this bit of code helps. Just trying to replace anything with $0 with a line of text.

 

         <p class="product-single__prices">
            {% if product.price == 0 %}
        		Call for price
            {% endif %}
            {% if product.compare_at_price_max > product.price %}
              <span id="ComparePriceA11y" class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
            {% else %}
              <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
            {% endif %}
            <span id="ProductPrice" class="product-single__price" itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
              {{ current_variant.price | money }}
            </span>

            {% if product.compare_at_price_max > product.price %}
              <span id="PriceA11y" class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
              <s class="product-single__price--compare" id="ComparePrice">
                {{ current_variant.compare_at_price | money }}
              </s>
            {% endif %}

            {% include 'product-unit-price', variant: current_variant, available: true %}
          </p>

          {%- if shop.taxes_included or shop.shipping_policy.body != blank -%}
            <div class="product-single__policies rte">
              {%- if shop.taxes_included -%}
                {{ 'products.product.include_taxes' | t }}
              {%- endif -%}
              {%- if shop.shipping_policy.body != blank -%}
                {{ 'products.product.shipping_policy_html' | t: link: shop.shipping_policy.url }}
              {%- endif -%}
            </div>
          {%- endif -%}

          {% form 'product', product, class:'product-form' %}
            <select name="id" id="ProductSelect-{{ section.id }}" class="product-single__variants">
              {% for variant in product.variants %}
                {% if variant.available %}
                  <option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
                {% else %}
                  <option disabled="disabled">
                    {{ variant.title }} - {{ 'products.product.sold_out' | t }}
                  </option>
                {% endif %}
              {% endfor %}
0 Likes

Success.

Trailblazer
153 15 18

Replace the first part of the code with this:

<p class="product-single__prices">
  {% if product.price == 0 %}
  Call for price
  {% else %}
  {% if product.compare_at_price_max > product.price %}
  <span id="ComparePriceA11y" class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
  {% else %}
  <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
  {% endif %}
  <span id="ProductPrice" class="product-single__price" itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
    {{ current_variant.price | money }}
  </span>

  {% if product.compare_at_price_max > product.price %}
  <span id="PriceA11y" class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
  <s class="product-single__price--compare" id="ComparePrice">
    {{ current_variant.compare_at_price | money }}
  </s>
  {% endif %}

  {% include 'product-unit-price', variant: current_variant, available: true %}
  {% endif %}
</p>

 

Let's make the best store!
Contact us at: thepremierstores@gmail.com
1 Like
Excursionist
18 1 0

THANK YOU SOOOOOOOOO MUCH! This was EXACTLY what I was trying to accomplish! Cheers!

0 Likes
Excursionist
18 1 0

@PremierStores 

 

Is there another line I can add in there as well to hide the add to cart option if equals $0 as well?

 

Thank you for your time!

0 Likes
Trailblazer
153 15 18

Add the if and endif code around the button tag, like this:

{% if product.price == 0 %}
            <div class="product-single__cart-submit-wrapper{% if section.settings.enable_payment_button %} product-single__shopify-payment-btn{% endif %}{% if section.settings.add_to_cart_width == 'full_width' %} product-form--full{% endif %}">
              <button type="submit" name="add" id="AddToCart" class="btn product-single__cart-submit{% if section.settings.add_to_cart_width == 'full_width' %} btn--full{% endif %}{% if section.settings.enable_payment_button %} shopify-payment-btn btn--secondary{% endif %}" data-cart-url="{{ routes.cart_url }}">
                <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
              </button>
              {% if section.settings.enable_payment_button %}
                {{ form | payment_button }}
              {% endif %}
            </div>
{% endif %}

 

Let's make the best store!
Contact us at: thepremierstores@gmail.com
0 Likes
Excursionist
18 1 0

My button tag currently looks like this wrapped in other if/else. Are you able to assist me of how to manage it with this? Thank you!

 

            <div class="product-single__cart-submit-wrapper{% if section.settings.enable_payment_button %} product-single__shopify-payment-btn
            {% endif %}
            {% if section.settings.add_to_cart_width == 'full_width' %} product-form--full
            {% endif %}">
              
              <button type="submit" name="add" id="AddToCart" class="btn product-single__cart-submit
            {% if section.settings.add_to_cart_width == 'full_width' %} btn--full
            {% endif %}
            {% if section.settings.enable_payment_button %} shopify-payment-btn btn--secondary
            {% endif %}" data-cart-url="{{ routes.cart_url }}">
                <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
              </button>
              {% if section.settings.enable_payment_button %}
                {{ form | payment_button }}
              {% endif %}
            </div>

          {% endform %}
0 Likes
Trailblazer
153 15 18

This is how the code should look

 

{% if product.price == 0 %}
            <div class="product-single__cart-submit-wrapper{% if section.settings.enable_payment_button %} product-single__shopify-payment-btn
            {% endif %}
            {% if section.settings.add_to_cart_width == 'full_width' %} product-form--full
            {% endif %}">
              
              <button type="submit" name="add" id="AddToCart" class="btn product-single__cart-submit
            {% if section.settings.add_to_cart_width == 'full_width' %} btn--full
            {% endif %}
            {% if section.settings.enable_payment_button %} shopify-payment-btn btn--secondary
            {% endif %}" data-cart-url="{{ routes.cart_url }}">
                <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
              </button>
              {% if section.settings.enable_payment_button %}
                {{ form | payment_button }}
              {% endif %}
            </div>
{% endif %}
          {% endform %}
Let's make the best store!
Contact us at: thepremierstores@gmail.com
0 Likes