Knowledge baseAccelerator for WordPress

Spectra#

The plugin can be gotten here. Assets file generation as separated files should be disabled.

FOX – Currency Switcher Professional for WooCommerce#

The plugin can be gotten here.

To correct switching behavior:

  • Set the ‘Settings’ -> ‘Options’ -> ‘Currency storage’ to ‘Transient’ (only if ‘FOX Session’ doesn’t work).
  • Add @^wccs_changed_currency$@ to cookies part in user cache group named ‘ WooCommerce’.
  • Insert the next HTML code at the bottom inside of body tag by any code snippet plugin (e.g. Code Snippets):

<script seraph-accel-crit="1">
(
function( d )
{
function _getCookie( name )
{
var m = d.cookie.match( new RegExp( '(^| )' + name + '=([^;]+)' ) );
return ( m ? m[2] : "" );
}
.
function _setCookie( name, v )
{
// Set the cookie with a path to make it accessible site-wide
var expires = new Date();
expires.setTime( expires.getTime() + 365 * 24 * 60 * 60 * 1000 ); // 1 year expiration
d.cookie = name + '=' + v + ';path=/;SameSite=Lax;expires=' + expires.toUTCString();
}
.
// Implementation for '.woocommerce-currency-switcher' control
d.querySelectorAll( "select[name=\"woocommerce-currency-switcher\"]" ).forEach(
function( e )
{
e.addEventListener( "change",
function()
{
_setCookie( "wccs_changed_currency", _getCookie( "wccs_init_currency" ) == this.value ? "" : this.value );
}
);
.
if( !_getCookie( "wccs_init_currency" ) )
_setCookie( "wccs_init_currency", e.value );
}
);
.
// Implementation for '.woocs-style-1-dropdown' control
d.querySelectorAll( ".woocs-style-1-dropdown" ).forEach(
function( e )
{
var curValText = e.querySelector( ".woocs-style-1-select > span" );
if( curValText )
curValText = curValText.textContent;
.
e.querySelectorAll( ".woocs-style-1-dropdown-menu li" ).forEach(
function( eItem )
{
if( eItem.textContent == curValText && !_getCookie( "wccs_init_currency" ) )
_setCookie( "wccs_init_currency", eItem.getAttribute( "data-currency" ) );
.
eItem.addEventListener( "click",
function()
{
var vCur = this.getAttribute( "data-currency" );
_setCookie( "wccs_changed_currency", _getCookie( "wccs_init_currency" ) == vCur ? "" : vCur );
}
);
}
);
}
);
}
)( document );
</script>

Warning: Server or cloud caching should be disabled if ‘wccs_changed_currency’ cookie is not empty.

Leave a Reply