If else statements not working as expected in Custom Liquid Code

Topic summary

Shopify product-specific content set via Custom Liquid conditionals (if/elsif on product.handle and product.id) shows correctly in the Theme Editor but the live site consistently displays the content for “red-light-oil-massager” across other products. Similar issue occurs with slide groups tied to product IDs: even after deleting slides 1-2-3, the live product with ID 6789 still shows them. Cache clearing did not help.

Images are provided comparing the correct admin view vs. incorrect live view, indicating a preview vs. live mismatch is central to the issue.

Suggestions raised:

  • Verify you’re editing under the correct Market in the Theme Customizer (Shopify Markets), as per-market content can differ.
  • Confirm the Liquid context actually exposes the current product as product where the Custom liquid is placed.
  • Share actual Liquid code and a live URL for deeper debugging; one participant offered a collaborator invite to investigate.

Latest update: the store owner states there are no other active Markets. No resolution yet; further debugging and code/link sharing are pending.

Summarized with AI on December 15. AI used: gpt-5.

{% if product.handle == “red-light-oil-massager” %}
Show text ABC{% elsif product.handle == “purewater-derma-showerhead” %}show text xyz{% endif %}

I am using static text directly in custom liquid, it shows accordingly in admin panel when I am editing, but when I save and check live, it did not work, it keep showing “red-light-oil-massager” content on other product handle,

I have another similar case:-
I have slide groups, I am trying to show different slides, according to product Id’s, same error, even after deleting all content of 1 product slide, it still appearing on other product,

Like
{% if product.id == 12345 %}
show slides from 1-2-3
{%elsif product.id == 6789 %}
show slides from 4-5-6
{% endif %}

now after deleting complete slides and the text of slides 1-2-3,
The live site still showing 1-2-3 slides and text of slide on product ID 6789(while in admin panel it showing correct)
I have cleared the cache, but still not resolving, can anyone help me with this?

Note:- I am not using custom data, is that the problem?

This is admin view in admin panel,

and this is what appears on live, even I have removed all these slides and text :()

Hi @Zainalee ,

This will need to be checked in more detail, can I send you a collaborator invite? it will help me debug things better

If you have multiple markets, make sure that when you’re editing in Customizer it happens under proper market.

Also, make sure that current product variable is actually called product where you apply your “Custom liquid”.

Otherwise, if you can share actual liquid code and link to a page where it does not work as you wish it would be easier to suggest something.

I have no other active markets yet!