Support » Plugin: Price Based on Country for WooCommerce » Wrong prices with Lightspeed cache plugin

  • Resolved Nauriskolats

    (@nauriskolats)


    Hi Oscar,

    Thanks for the plugin and your efforts maintaining it!
    I’m having an issue with Lightspeed cache plugin. If I disable it – the prices are correctly displayed for everyone (checked using geopeeker.com), however if the caching plugin is enabled, it does not render prices correctly (even changing WooCommerce > Geolocate (with page caching support) does not solve it for me)

    Any suggestions?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Oscar Gare

    (@oscargare)

    Thread Starter Nauriskolats

    (@nauriskolats)

    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.

    Plugin Author Oscar Gare

    (@oscargare)

    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.

    Plugin Author Oscar Gare

    (@oscargare)

    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 5 months, 3 weeks ago by Oscar Gare.
    Thread Starter Nauriskolats

    (@nauriskolats)

    Thanks, Oscar, I will give it a try.
    P.S. I was using a VPN for testing as well.

    Thread Starter Nauriskolats

    (@nauriskolats)

    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?

    Thread Starter Nauriskolats

    (@nauriskolats)

    Maybe there is a cookie that should be excluded from Lightspeed cache caching that would fix this?

    Plugin Author Oscar Gare

    (@oscargare)

    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();
    Thread Starter Nauriskolats

    (@nauriskolats)

    Thank you @oscargare, you have been very helpful!
    I have adjusted my pricing output and everything works like a charm 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.