What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: How to show conditional theme blocks

How to display conditional theme blocks in certain product and cart pages?

georgef
Shopify Partner
8 0 2

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

Replies 2 (2)

gr_trading
Shopify Partner
1973 146 205

Best would be displayed all your featured collection on page and hide them all using CSS rest logic you have already explained.

 

Hope this will help...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee

BSS-Commerce
Shopify Partner
3477 463 548

Hi @georgef ,

 

Shopify's current free themes do not yet support the functionality you are talking about. This function will require quite deep customization into the theme. I recommend hiring an expert. Currently, the best solution I can come up with is to add a feature collection to the product page or cart page in Customize.

 

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency