Thank you, Oscar, for the link.
I already followed this guide before testing various ways to get it working, but without success until I deactivate Lightspeed cache plugin.
Hi,
The plugin will run an AJAX request per page to refresh the prices if the “load product price in the background” option is enabled. Make sure Lightspeed does not cache the URLs that contain the query ?wc-ajax=wcpbc_get_location.
Also, Geopeeker does not run the javascript, so it’s not a good way to test. Using a VPN software instead:
https://www.pricebasedcountry.com/docs/getting-started/testing/#section-4
-
This reply was modified 4 years, 5 months ago by
Oscar Gare.
Thanks, Oscar, I will give it a try.
P.S. I was using a VPN for testing as well.
Thank you Oscar, that seems to have worked now.
But now I have another issue – the main price of the product is displayed fine, however down below I am outputting related products and use get_variation_price_by_id() function to display it. It does not seem to be affected by the changes we made earlier. Any way to solve this and make the prices appear correct there as well?
Are there any hooks that I can use that would help in changing the output there?
Maybe there is a cookie that should be excluded from Lightspeed cache caching that would fix this?
Hi,
get_variation_price_by_id does not work. The “load product price in the background” option requires the theme to use the $product->get_price_html() to output the price.
Replace get_variation_price_by_id with
$v_product = wc_get_product( $variation_id );
echo $v_product->get_price_html();
Thank you @oscargare, you have been very helpful!
I have adjusted my pricing output and everything works like a charm 🙂