How to show conditional theme blocks


I am trying to display a section block (Featured Collection) conditionally on certain product and cart pages.

 

For example, on the Cart page, if the customer has not added a Greeting Card to their cart, I would like to show that collection; however, if they have already added one, I would like to not show it.

 

I know how to loop through the cart items in liquid for the actual conditional criteria, I’m just not sure how to then conditionally render the blocks.

 

I’m guessing I would need to render it directly in liquid and not in the theme editor? But then I’m not sure how to add the details, like which collection to show, which font sizes to use, etc.

 

Any guidance would be appreciated!

 

Thanks



Source link

Leave a Comment