How to render a snippet on the homepage section?

Solved

How to render a snippet on the homepage section?

Siemon-Schilder
Excursionist
22 1 2

Hi,

I'm trying to render a snippet on the homepage featured-product section, or in the homepage in general. I've managed to render this snippet on the product page (for hiding the unavailable variants). But I have a featured product on the homepage, which also needs this. Can someone show me how to render this snippet properly so it will apply to the featured product on the homepage? Thanks!

This is my homepage: https://earlorange.com/

This is what I did on the Theme.liquid to render the snippet on the product page, it works well. 

Screenshot 2020-07-28 at 15.46.55.png

I want to render the 'Hide-variants' on the featured-product on my homepage, so the unavailable won't appear. 

Screenshot 2020-07-28 at 15.59.42.png

Accepted Solution (1)
diego_ezfy
Shopify Partner
2969 571 906

This is an accepted solution.

Hello,

1. Create a new snippet in the "snippets" folder called "test-me"
2. Add some simple code just to make sure it renders, something like <p>hello from snippet</p>
3. Render it with {% include 'test-me' %}

If that shows up it means the snippet is being rendered properly. From there proceed to develop your own code.


Let me know whether it works.

 

View solution in original post

Replies 5 (5)

Siemon-Schilder
Excursionist
22 1 2

Does anyone have experience with this or anything similar? If you can share some thought that'd be great.  Thanks in advance!

diego_ezfy
Shopify Partner
2969 571 906

Use {% include 'hide-variants' %}

I'd recommend making it lowercase as well. Instead of Hide rename it to hide.

Kind regards,
Diego

Siemon-Schilder
Excursionist
22 1 2

Hi Dantepw,

Thank you for the suggestion. I really appreciate it!

I tried the changes but it doesn't work 😞 Any clue where to double check?

Thanks,

Siemon

diego_ezfy
Shopify Partner
2969 571 906

This is an accepted solution.

Hello,

1. Create a new snippet in the "snippets" folder called "test-me"
2. Add some simple code just to make sure it renders, something like <p>hello from snippet</p>
3. Render it with {% include 'test-me' %}

If that shows up it means the snippet is being rendered properly. From there proceed to develop your own code.


Let me know whether it works.

 

Siemon-Schilder
Excursionist
22 1 2

It works, thanks for the advice