I would like to hide prices on sold item on Venture theme

New Member
2 0 0

I tried a lot of solution but nothings works. I just want to hide prices in the product page because it already hide it in the collection page as it show the word "sold" instead of the price.

My website is https://antichitagalliera.com/

Thank you in advance.

0 Likes
Excursionist
12 1 3

Hi Marina. My answer is going to assume that you're using Shopify to track inventory and that when a product is sold, that the product is now unavailable. In that case, you can just wrap the code for the price on your product pages in a conditional to check if the product is available. Like this:

 

{% if product.available %}
// existing code for product price
{% endif %}

Also, you'll want to test this first in a duplicate theme to make sure that hiding the product price does not cause any Javascript errors and break the page. And check if the product price is being shown twice in different locations in the code for mobile and desktop views.

1 Like
New Member
2 0 0

Thank you for your quick answer. I can't find the existisng code for product price and i guess because my code was previously modified.  I thinkthe correct line to place your code in somewhere in this code ( this is from product template . liquid ). Can someone help me ? 

    <div class="grid__item {% if product.images.size > 1 %}medium-up--two-fifths{% else %}medium-up--one-half{% endif %}" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
      <div class="product-single__info-wrapper">
        <meta itemprop="priceCurrency" content="{{ shop.currency }}">
        <link itemprop="availability" href="http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}">

        <div class="product-single__meta small--text-center">
          {% if settings.product_vendor_enable %}
            <p class="product-single__vendor">{{ product.vendor }}</p>
          {% endif %}

          <h1 itemprop="name" class="product-single__title">{{ product.title }}</h1>

          <ul class="product-single__meta-list list--no-bullets list--inline">
            <li id="ProductSaleTag-{{ section.id }}" class="{% unless product.compare_at_price > product.price %}hide{% endunless %}">
              <div class="product-tag">
                {{ 'products.product.on_sale' | t }}
              </div>
            </li>
            <li>
              {% unless product.compare_at_price_max > product.price %}
                <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
              {% endunless %}
              <span id="ProductPrice-{{ section.id }}" class="product-single__price" itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
                {{ current_variant.price | money }}
              </span>
            </li>
            {% if product.compare_at_price_max > product.price %}
              <li>
                <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
                <s id="ComparePrice-{{ section.id }}" class="product-single__price product-single__price--compare">
                  {{ current_variant.compare_at_price | money }}
                </s>
              </li>
0 Likes
Excursionist
12 1 3

On the line after your product title (<h1 itemprop="name"...), add this...

 

{% if product.available %}

 

then find the closing tag for the <ul class="product-single__meta-list element. The closing tag is </ul>. On the line after that add this...

 

{% endif %}

I can't see far enough down on the code you provided but it should look something like this...

 

<h1 itemprop="name" class="product-single__title">{{ product.title }}</h1>

{% if product.available %}

          <ul class="product-single__meta-list list--no-bullets list--inline">
            <li id="ProductSaleTag-{{ section.id }}" class="{% unless product.compare_at_price > product.price %}hide{% endunless %}">
              <div class="product-tag">
                {{ 'products.product.on_sale' | t }}
              </div>
            </li>
            <li>
              {% unless product.compare_at_price_max > product.price %}
                <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
              {% endunless %}
              <span id="ProductPrice-{{ section.id }}" class="product-single__price" itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
                {{ current_variant.price | money }}
              </span>
            </li>
            {% if product.compare_at_price_max > product.price %}
              <li>
                <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
                <s id="ComparePrice-{{ section.id }}" class="product-single__price product-single__price--compare">
                  {{ current_variant.compare_at_price | money }}
                </s>
              </li>
...more code that isn't shown
</ul> (<-- find this) {% endif %}
0 Likes