Liquid Template Caching

fyshman
New Member
2 0 0

Hello,

This is probably a beginner's question. First time building a custom theme for a Shopify store.

I have Typeform form that does a redirect to URL upon completion (to my Shopify page). It passes in a bunch of parameters into the URL for my Shopify page. 

ie.: ?question1=answer1&question2=answer2

For my Shopify page, I created a custom page template that reads all the params from the URL and based on some logic, provides a product recommendation. All this logic is hardcoded into that Shopify page template. 

The page renders the recommendation properly with the logic, however, my issue is that it caches, and on subsequent form loads (and completion) it doesn't pick up the changes in the URL params and re-renders the template, thus it displays the old answers. This happens unless I make a change to the page, which triggers versioning, and then it works properly again.

How do I force no cache for the template rendering? Or is there a better way for me to trigger this logic code recommendation? 


Thanks!
J

 

 

 

0 Likes
attotasolutions
Shopify Partner
16 0 6

Hello Shopify!

Do you have answer for that issue?

I am also having the same issue with cached content.

 

{% if param_val == 'a' %}
    {% include 'design-a' %}
{% if param_val == 'b' %}
    {% include 'design-b' %}
{% else %}
    {% include 'design-fefault' %}
{% endif %}

 

But this will always display the content same from first visited URL.

 

0 Likes
fyshman
New Member
2 0 0

Hey @attotasolutions 

I ended up re-writing the entire logic with JavaScript and placed the file in the assets folder. 

The .liquid templating piece I kept the content and it just hides and shows the content based on css attribute and references the JS file. The JS would execute the logic itself and display the correct result accordingly. 

I couldn't find a way to avoid the caching. I was hoping to avoid re-writing it altogether but it looked like I wasn't able to.

Hope this helps!

0 Likes
attotasolutions
Shopify Partner
16 0 6

Hi,

We can hide/show it using JavaScript. But all the content should display on DOM document. If it is a 1-2 lines of paragraph that will be fine. But if it has large number of content..... It is not a good practice in terms of performance/speed optimization/SEO.

Shopify team.. Please respond on it...

0 Likes