Hey,
I am sharing my solution in case you still need help. I don’t like the AJAX option as it causes delays, instead, I prefer creating cache varies via Litespeed.
Here’s an example of what I have in my .htaccess file:
# For users from EU countries (VAT purposes)
RewriteCond %{HTTP:CF-IPCountry} ^(AT|BE|BG|HR|CY|CZ|DK|EE|FI|FR|DE|GR|HU|IE|IT|LV|LT|LU|MT|NL|PL|PT|RO|SK|SI|ES|SE)$
RewriteRule .* - [CO=currency:EURVAT:.yourdomain.com,E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+eurvat]
# For users from US
RewriteCond %{HTTP:CF-IPCountry} ^US$
RewriteRule .* - [CO=currency:USD:.yourdomain.com,E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+usd]
# For users from Canada
RewriteCond %{HTTP:CF-IPCountry} ^CA$
RewriteRule .* - [CO=currency:CAD:.yourdomain.com,E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+cad]
# For users from Australia
RewriteCond %{HTTP:CF-IPCountry} ^AU$
RewriteRule .* - [CO=currency:AUD:.yourdomain.com,E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+aud]
# For users from United Kingdom
RewriteCond %{HTTP:CF-IPCountry} ^GB$
RewriteRule .* - [CO=currency:GBP:.yourdomain.com,E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+gbp]
You can adjust as per your setup with Price based on Country for Woocommerce.
It is important to note that you should also add proper crawler settings for each cookie in Litespeed -> Crawler -> Simulation Settings -> Cookie Simulation
Under Cookie Name add currency, and on the right add the cookie names you have set up in the .htaccess file.