Incompatibility with WooCommerce Geolocation (with caching)

Hi there,

I have geolocation with page caching enabled within woocommerce. However, this results in a double page load inside the “frame” when editing with Pro. And instead of allowing you to edit, it goes back to the “What do you want to launch” message.

This has already been discussed in https://theme.co/apex/forum/t/strange-doubling-cornerstone-behaviour/25793, however, this was over a year ago and I was hoping that the issue would be resolved.

Any update on this?

Hi @kjhosting,

We’re still working on it.

Please set the Default customer location to Geolocate instead:


Regards!

I cannot do that, as wp-rocket then caches incorrect pricing for the different currencies (we use multiple currencies). We need to have Geolocate (with page caching support) for our site to work. Otherwise, we have users being shown a currency from another country.

So, I’ve solved the issue.

In my child theme’s functions.php, I added the following:

//to dequeue the geolocation script
function kjh_dequeue_geolocation_script(){
    if ( isset( $_POST['cs_preview_state'] ) && $_POST['cs_preview_state'] != "off" ){
        wp_dequeue_script( 'wc-geolocation' );
        wp_deregister_script( 'wc-geolocation' );
    }
 }
add_action('wp_enqueue_scripts', 'kjh_dequeue_geolocation_script',100);

Glad to hear that and thanks for taking out the time to share the solution with community members. :slight_smile:

Hi @kjhosting,

Thanks again for sharing your solution with us. I just wanted to confirm with you that we’ve corrected this problem for the next release. We’ve taken a similar approach of dequeuing the script for the iframe.