Collapsible row for product size chart, how to hide when it's not a shirt

prototype44
Visitor
2 0 1

I have mostly shirts in my store so I want to create a size chart that's collapsible in the product page. I'm going to use a dynamic content connected to a page. I create a page for men's sizes, and a page for toddler sizes. But for things like coffee mug, the entire thing doesn't make sense so I will not select any element in the metadata field. I wanted to make it so the row doesn't show up.

I tried something like check to see if

block.settings.content != blank

or 

block.settings.page.content != blank

But it doesn't work. I think it's because it's dynamic content?

Reply 1 (1)
PaulNewton
Shopify Partner
5931 537 1241

Instead of editing theme code use alternate templates for behavior like this.

https://help.shopify.com/en/manual/online-store/themes/os20/theme-structure/templates#create-a-new-t... 

 

If you must do this as code verify what you think your operating on and output it directly for inspection:

block.settings.page.content: "--> {{ block.settings.page.content }} <--" , the <--" are just random characters to ensure it's easy to spot actually empty content.

 

It may need to be {% if block.settings.page.content != "" %} , {% if block.settings.page.content != "<p></p>" %} or some such

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org