Removing price from product in Narrative theme

Solved

Removing price from product in Narrative theme

catlinblair
Tourist
6 0 1

I am not very techy but I am willing and able to follow clear directions, and willing to learn a bit of code if I can.

Can someone give me more specific instruction on how to remove the price from all the products in a specific collection in Narrative Theme? 

I found this thread:

https://community.shopify.com/c/technical-q-a/narrative-theme-remove-price-when-it-s-zero/m-p/103415...

But I was not able to follow the directions because they were meant for someone with more advanced knowledge than myself.

Any help is much appreciated!

Thanks!

 

Accepted Solution (1)
diego_ezfy
Shopify Partner
2970 571 921

This is an accepted solution.

@catlinblair,

1. In your Shopify Admin go to online store > themes > actions > edit code
2. In your theme.liquid file, find the </body> (press CTRL + F or command + F on Mac)
3. paste this code right above the </body> tag:

 

<script>
var hidePriceIfZero = (async () => {
    var url = `${window.location.href}.json`
    let response = await fetch(url);
    const { product }  = await response.json();
    const price = product.variants[0].price

    if (price === '0.00'){
        
    const $price = document.querySelector(`.product__price`);
    $price.style.display = 'none';
    }
  })();
</script>

 


Kind regards,
Diego

View solution in original post

Replies 10 (10)

ZestardTech
Shopify Partner
6041 1080 1449

Hello There,

Please share your store URL and screenshot.
So that I will check and let you know the exact solution here.

Want to modify or develop new app, Hire us.
If helpful then please Like and Accept Solution .
Email: support@zestard.com
Shopify Apps URL :- https://apps.shopify.com/partners/zestard-technologies
Custom Modifications Into Shopify Theme | Shopify Private App | SEO & Digital Marketing
catlinblair
Tourist
6 0 1

Screen Shot 2021-10-02 at 1.21.52 PM.png

Thank you for your help.  My site is https://catlinblair.myshopify.com/ and a sample of one of the products in question is : https://catlinblair.myshopify.com/products/oracle-necklace

LitExtension
Shopify Partner
4895 1004 1174

Hi @catlinblair,

Please follow these steps:

- Step 1: Go to Online store > Themes > Actions > Edit code.

- Step 2: Go to snippets > product-card.liquid, find 'product.available' and add code:
{% unless collection.handle == 'collection handle' %} {% endunless %}

Ex: You want to hide the price at Accessories collection with handle: accessories. Get handle: https://i.imgur.com/OEhc714.png

Add code: https://i.imgur.com/OZEmF18.png

With 2 collections, code:
{% unless collection.handle == 'handle1' and collection.handle == 'handle2' %} {% endunless %}

Hope it helps!

If my answer can help you solve your issue, please kindly mark it as a solution. Thank you and good luck.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com
catlinblair
Tourist
6 0 1

 Thank you for the suggestion. Here is a screen shot of how I followed step 2 that you provided.  It doens't seem to have changed anything.

I am sure I probably didn't do it right, can you give some more instruction?

Much appreciated!

Screen Shot 2021-10-03 at 10.33.43 AM.png

 

diego_ezfy
Shopify Partner
2970 571 921

@catlinblair 

Your website is password locked.

diego_ezfy_0-1633284361804.png

 

catlinblair
Tourist
6 0 1

Password is aogaym

 

diego_ezfy
Shopify Partner
2970 571 921

This is an accepted solution.

@catlinblair,

1. In your Shopify Admin go to online store > themes > actions > edit code
2. In your theme.liquid file, find the </body> (press CTRL + F or command + F on Mac)
3. paste this code right above the </body> tag:

 

<script>
var hidePriceIfZero = (async () => {
    var url = `${window.location.href}.json`
    let response = await fetch(url);
    const { product }  = await response.json();
    const price = product.variants[0].price

    if (price === '0.00'){
        
    const $price = document.querySelector(`.product__price`);
    $price.style.display = 'none';
    }
  })();
</script>

 


Kind regards,
Diego

catlinblair
Tourist
6 0 1

oof.  I appreciate the help but I am unable to make it work.  I did (I think) exactly what you said and nothing happened at all. 

I found theme.liquid under the Layout folder in the "edit code" section for my theme, and then added your code right where you said, near the bottom of the code sheet.

I suppose I am just doing something wrong but I'll be darned if I know what it is!

Screen Shot 2021-10-03 at 12.35.32 PM.png

 

diego_ezfy
Shopify Partner
2970 571 921

@catlinblair 

There was a typo in my code, it should work now.

catlinblair
Tourist
6 0 1

Woo Hoo!  Thank you so much, I can't believe it I got it to work!  YES! Thank you Thank you.