Hide Sidebar Product Block if No Related Product (Ella Theme)

Solved

Hide Sidebar Product Block if No Related Product (Ella Theme)

DRHP
New Member
9 0 0

Hi everyone,

 

I'm using the Ella theme, and my blog posts have a [sidebar] product block. I want to hide this block when there is no related product, but I'm not sure which Liquid file controls it.

I inspected the page using DevTools but couldn’t pinpoint the exact file where this block is generated. Does anyone know where I should look and how to modify the Liquid code to conditionally hide the block when no related product exists?

 

Thanks in advance for your help!

Accepted Solution (1)

gr_trading
Shopify Partner
2045 149 206

This is an accepted solution.

Hi @DRHP ,

 

This be done by two ways.

 

1. If you know that few blog will not have any product for suggestions, you can create template with no sidebar and assign the relevant template to blog.

2. if its dynamic or products are coming based on some logic you have to validate the data and write condition to have full width.

 

Request you to share the .liquid file code to help you in this.

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

View solution in original post

Replies 6 (6)

Mustafa_Ali
Explorer
346 28 56

hey @DRHP  plz share the URL of your website so i can help you

DRHP
New Member
9 0 0

Hello, thanks!

This is the current link:
https://dr-rath-at.myshopify.com/

When clicking the main header button or any of the images under "Aktuell", you are redirected to a blog page.

pawankumar
Shopify Partner
710 102 123

Hi @DRHP 
I hope you are doing well.
If you have article.json, then please check that you will have a section like main-article or something
You can check for main-article.liquid or similar file under sections and you will find sidebar
You can control from their using liquid condition

Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan

gr_trading
Shopify Partner
2045 149 206

This is an accepted solution.

Hi @DRHP ,

 

This be done by two ways.

 

1. If you know that few blog will not have any product for suggestions, you can create template with no sidebar and assign the relevant template to blog.

2. if its dynamic or products are coming based on some logic you have to validate the data and write condition to have full width.

 

Request you to share the .liquid file code to help you in this.

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
DRHP
New Member
9 0 0

I followed  your first option and it works great. Don't know why I didn't think of this myself.

Thank you!!

gr_trading
Shopify Partner
2045 149 206

Glad to know if works.

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