Hide prices in product recommendations on product page

Highlighted
Excursionist
21 0 1

Hi,

 

I want to be able to hide prices in the product recommendation section there is at the bottom of the product page.
I want to be able to hide prices in some collections and products, but also in the product recommendation section.

Right now I have tried this code in the product-card-grid.liquid file:

<div class="h4 grid-view-item__title product-card__title" aria-hidden="true">{{ product.title }}</div> {% comment %} {% include 'product-price', variant: product.selected_or_first_available_variant %} {% endcomment %}

</div>


I am using the Debut theme.

Hope someone are willing to help me out.

 

0 Likes
Shopify Partner
1751 289 373

Hi @jp-jp 

This snippet used by collection page and recommendations page, but you just want to hide price from recommendations section so you have to make condition on recommendations file like bellow:

add condition where you have added recommendations section like {% include 'recommendations' with 'recomm' %}

Note: here add your recommendations file 

 

get this in snippet->recommendations like

{% if recommendations =='recomm' %}
// hide price here
{% else %}
//show price here
{%endif%}
Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
1 Like
Shopify Partner
839 82 125

That comment should do it, assuming the recommendation block is the default recommendation block for the theme and not an app. Are you sure you are changing the code of the theme you are validating the result for? Is this on the live theme? Can you share an URL to your store so I can validate that?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
1 Like
Excursionist
21 0 1

Hi,

 

I want to be able to use some collections and product pages without the price. And here the price also need to be hidden in the product recommendation.
Right now, I have created a template for the collection and product page without the price. 
But the product recommendation is still having visible prices.

 

Here is my website, click here to go to it.
Password: fray

 

 

0 Likes
Shopify Partner
839 82 125

from what I can see the code is not commented out so it's either a misspelled piece or the changes are not made to the snippets/product-card-grid.liquid file

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
1 Like
Excursionist
21 0 1

Weird because I have commented it out as you can see below:

<div class="grid-view-item{% unless product.available %} grid-view-item--sold-out{% endunless %} product-card" data-product-card>
  <a class="grid-view-item__link grid-view-item__image-container full-width-link" href="{{ product.url | within: collection }}">
    <span class="visually-hidden">{{ product.title }}</span>
  </a>

  {% capture img_id %}ProductCardImage-{{ section.id }}-{{ product.id }}{% endcapture %}
  {% capture wrapper_id %}ProductCardImageWrapper-{{ section.id }}-{{ product.id }}{% endcapture %}
  {%- assign img_url = product.featured_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}

  {% unless product.featured_image == blank %}
    {% include 'image-style' with image: product.featured_image, width: max_height, height: max_height, small_style: true, wrapper_id: wrapper_id, img_id: img_id %}
  {% endunless %}

  <div class="product-card__image-with-placeholder-wrapper" data-image-with-placeholder-wrapper>
    <div id="{{ wrapper_id }}" class="grid-view-item__image-wrapper product-card__image-wrapper js">
      <div style="padding-top:{% unless product.featured_image == blank %}{{ 1 | divided_by: product.featured_image.aspect_ratio | times: 100 }}%{% else %}100%{% endunless %};">
        <img id="{{ img_id }}"
              class="grid-view-item__image lazyload"
              alt="{{ product.featured_image.alt }}"
              data-src="{{ img_url }}"
              data-widths="[180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048]"
              data-aspectratio="{{ product.featured_image.aspect_ratio }}"
              data-sizes="auto"
              data-image>
      </div>
    </div>
    <div class="placeholder-background placeholder-background--animation" data-image-placeholder></div>
  </div>

  <noscript>
    {% capture image_size %}{{ max_height }}x{{ max_height }}{% endcapture %}
    <img class="grid-view-item__image" src="{{ product.featured_image.src | img_url: image_size, scale: 2 }}" alt="{{ product.featured_image.alt }}" style="max-width: {{ max_height | times: product.featured_image.aspect_ratio }}px;">
  </noscript>

  <div class="h4 grid-view-item__title product-card__title" aria-hidden="true">{{ product.title }}</div>

 {% comment %} {% include 'product-price', variant: product.selected_or_first_available_variant %} {% endcomment %}

</div>
0 Likes
Shopify Partner
839 82 125

What if you remove that line with the commented include, are you still seeing the prices?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
1 Like
Excursionist
21 0 1

No it doesn't work.

 


When I look at the code when I inspect the element, it says the price is part of the div class called price__regular

0 Likes
Shopify Partner
839 82 125

Then it's definitely a different liquid file. If you can add me as a collaborator with access to your store themes I can look into it. Without it, it's quide hard to play the guess game.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
1 Like
Excursionist
21 0 1

Thanks, I will appreciate it.


Send me your email in a private message

0 Likes