Roots Discourse

FastCGI Caching with a currency convertor


Hi guys,

I’ve set up FastCGI Caching. I have a custom site using the Trellis, Bedrock and Sage 9 using a simple currency convertor which I’ve made myself. The currency is stored in a cookie. I was outputting the correct currency by running a simple function in functions.php, but obviously this is not going to be hit with FastCGI Caching. Do you guys have a best practise on how to handle situations like this? I thought about outputting all currencies (I only use three) in data attributes and then just displaying the correct one by detecting the cookie in JS on page load. But perhaps there’s a better way?