Shopify themes, liquid, logos, and UX
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:
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!
Solved! Go to the solution
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
Hello There,
Please share your store URL and screenshot.
So that I will check and let you know the exact solution here.
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
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.
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!
@catlinblair
Your website is password locked.
Password is aogaym
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
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!
@catlinblair
There was a typo in my code, it should work now.
Woo Hoo! Thank you so much, I can't believe it I got it to work! YES! Thank you Thank you.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024