Hide the price on a specific collection (Prestige theme)

Solved
oysterpots
Shopify Partner
12 0 0

Hi there,

 

I'm trying to hide the pricing on this page:

https://maisonmargauxltd.com/collections/hire-the-look

 

I've added the following code but I can't figure out why it's not working!

{% if collection.handle == 'hire-the-look' %}
<style>
.ProductItem__PriceList, .ProductMeta__Price{
display:none!important;
}
</style>
{% endif %}

 

Any thoughts/suggestions?

 

TIA 🙏

Accepted Solution (1)
Moeed
Shopify Partner
3046 760 924

This is an accepted solution.

Hey @oysterpots 

 

Upon checking your website, the prices are hidden and the product names are still there.

Moeed_0-1698144858797.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️

View solution in original post

Replies 9 (9)
Ruben_Dev
Shopify Partner
11 1 1

Hello there!

Ruben_Dev_0-1698142696100.png

 

Tou may try with the .price-list class and ensure your liquid is clean

 


-Need a assistance on your store? Chat on WhatsApp or email : albanhonfovou@proton.me
-Front-end Web Developer | Shopify Expert

The Freelance to power your Design and Performances
Moeed
Shopify Partner
3046 760 924

Hey @oysterpots 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file

4) Add the following code in the bottom of the file above </body> tag

{% if collection.handle == 'hire-the-look' %}
<style>
price-list.price-list {
    display: none !important;
}
</style>
{% endif %}

RESULT:

Moeed_0-1698142799807.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
oysterpots
Shopify Partner
12 0 0

Thanks Moeed, this has removed the pricing but also the product names! Is there a way to retain the name while removing the price?

 

Thanks again,

Lottie

Moeed
Shopify Partner
3046 760 924

This is an accepted solution.

Hey @oysterpots 

 

Upon checking your website, the prices are hidden and the product names are still there.

Moeed_0-1698144858797.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
oysterpots
Shopify Partner
12 0 0

Fabulous! This worked. Thanks so much Moeed, it's very much appreciated.


Lottie

Moeed
Shopify Partner
3046 760 924

Thank you for your reply. I'm glad to hear that the solution worked well for you. If you require any more help, please don't hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
oysterpots
Shopify Partner
12 0 0

It works on Chrome but when I check on Safari, all product information is missing:

Screenshot 2023-10-24 at 12.06.26.png

 

Any idea how to retain across browsers?

 

Thanks,

Lottie

oysterpots
Shopify Partner
12 0 0

Also it has removed the pricing across the site, not just for that one collection. This won't be an acceptable solution unfortunately.

 

Please advise if there's another way to tackle this.

 

Thanks,

Lottie

Ruben_Dev
Shopify Partner
11 1 1

Hello back !

Here is how you can achieve this
If liquid handle doesn't help you, you can use javascript and retrieve the slug of the current page. Then catch and check if you're on hire-the-look collection page

Add the following script in the file theme.liquid above </body> tag :

    <script>
      function getTheCurrentSlug(url) {
        // Split the URL by "/"
        const parts = url.split('/');
        
        // Get the last part (word) after the last "/"
        const slug = parts[parts.length - 1];
        
        return slug;
      }
      
      // Then check the url and remove the filter prices display
      const currentURL = window.location.href;
      const slug = getTheCurrentSlug(currentURL);
      if (slug === "hire-the-look"){
        const priceElements = document.querySelectorAll("price-list.price-list");      
        // Loop through the elements and hide each one
        priceElements.forEach(function(element) {
          element.style.display = "none";
        });
      }
    </script>


Hope this is helpful !

Don't forget to like and mark as accepted if it works !
Best regards


-Need a assistance on your store? Chat on WhatsApp or email : albanhonfovou@proton.me
-Front-end Web Developer | Shopify Expert

The Freelance to power your Design and Performances