How can I hide the Barcode on all collections/pages except one specific collection?

Solved
Jason101
Excursionist
34 1 7

Currently I am using the Barcode field in Shopify as a Release Date field for upcoming product drops and releases. Its working great, however I only want it to show on the "drop.collection" template that I made. 

So I want the Release Date to only show on the Drop collection and not when viewing that product on a different collection.

For example: https://www.photogrfr.com/collections/drops 

You can see the dates on this Drops collection page, however I do not want to see the dates when you are on any other collection like All Products or Men's Shirts for example.

Hope his makes sense and any help is appreciated! 

Drop Collection Page:

Drop1.jpg

 

All Products Collection Page:

Drop2.jpg

  

KetanKumar
Shopify Partner
20651 2144 7823

@Jason101 

sorry for that issue can you please try this code

1. Go to Online Store->Theme->Edit code
2. Asset->/stylesheet.css ->paste below code at the bottom of the file.
this code apply for after 5 - 6 second

.product-barcode {
    display: none;
}

 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes
Jason101
Excursionist
34 1 7

That works, however it removes it site-wide. I need the barcode to only show on drop.collection liquid, no other pages. I believe it would be an %if tag for the drop.collection liquid. How would that work?

KetanKumar
Shopify Partner
20651 2144 7823

@Jason101 

yes it work but make sure your css is required to liquid format

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
Jason101
Excursionist
34 1 7

@KetanKumar can you provide a code example? I am not positive I wrote this correctly but I believe it is along the lines of this. I want to hide the barcode on every page Except the collection.drop liquid.

{% else collection.drop" %}
.product-barcode {
	Display: none;
}
{% endelse %}

 

0 Likes
Ninthony
Shopify Partner
1975 296 784

You want to use an unless statement in that case:

 

{% unless collection.handle == 'drops' %}
.product-barcode {
	display: none;
}
{% endunless %}

 

 

This is assuming that your collection is named "Drops" it's handle would be "drops". I can only assume based on your screen shot.

This would hide the barcode on every collection except drop.

If my solution helped you, please like it and accept it as the solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
Jason101
Excursionist
34 1 7

@Ninthony @KetanKumar I made a small change here if this helps. I need the fa fa bolt icon to always show so I put it inline with the barcode text to only show on the collection.drop page.

I have everything laid out as I need it, but I want {{ product.variants[0].barcode }} to be hidden on every page except collection.drop

Basically I have a Fa Fa icon and a barcode next to each other, I only want the barcode to show on the collection.drop page. The fa fa bolt will always be visible on every page.

How can I hide just this barcode part?

1.jpg

 

0 Likes
Ninthony
Shopify Partner
1975 296 784

This is an accepted solution.

Same concept, just wrap that barcode liquid output in a if statement:


{% if collection.handle == "drops" %}{{ product.variants[0].barcode }}{% endif %}

 

So if your collection handle is "drops", then show the barcode, otherwise nothing shows.

If my solution helped you, please like it and accept it as the solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
Jason101
Excursionist
34 1 7

That worked! And I learned some new code. Thanks @Ninthony much appreciated. 

0 Likes
Ninthony
Shopify Partner
1975 296 784

No problem, glad it helped. Feel free to reach out whenever.

If my solution helped you, please like it and accept it as the solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes