• Resolved shadyr

    (@shadyr)


    Hi,

    I am using a caching plugin and the AJAX queries to redraw currency might be straining the server.

    https://ibb.co/y5KpQ2r

    Therefore, I would like to try disabling the currency functionality on all pages except checkout.

    In other words – on all pages except checkout show default currency, and use plugin functionality only on checkout.

    Is it possible?

    Thank you.

    Kind regards
    Radim

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hello @shady.
    Unfortunately the plugin does not have this function.
    But you can disable the plugin example like this:

    <?php
    add_filter(‘wp_head’,function(){
    if(!is_checkout()){
    add_filter( ‘option_active_plugins’, ‘luk_option_active_plugins’ );
    }
    });

    function luk_option_active_plugins( $plugins ){
    $unnecessary_plugins = array();

    if( !is_checout() ){
    $unnecessary_plugins[] = ‘woocommerce-currency-switcher/index.php’;
    }

    foreach ( $unnecessary_plugins as $plugin ) {
    $k = array_search( $plugin, $plugins );
    if( false !== $k ){
    unset( $plugins[$k] );
    }
    }

    return $plugins;
    }
    ?>

    Or without disabling the plugin:
    add_filter(‘wp_head’,function(){
    if(!is_checkout()){
    if(class_exists(‘WOOCS’)){
    global $WOOCS;
    $WOOCS->reset_currency();
    }
    }
    });

Viewing 1 replies (of 1 total)
  • The topic ‘Change currency only on Checkout’ is closed to new replies.