PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

WPBakery Recently Viewed Products Lag on Currency switch [WOOCS-LABS] ?

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

I'm working on a demo site for a client and we are using the pro version of the plug in, the switcher is working fine across the site apart from in a WPBakery widget for Recently Viewed products where it doesn't update, if it does update it sometimes changes to the currency I switched to previous to the one I'm on now.

Any suggestions for how to make it compatable would be welcome.

https://fruition2.wpengine.com/shop/

Hello

To get  license  key - https://codecanyon.net/downloads -> https://c2n.me/49ZXJv0.png

Paste your license key here - https://c2n.me/43SC6rb.png -> https://c2n.me/42HBIt7.png

Perhaps a third-party plugin stores these products with all data and therefore does not have the ability to display dynamic information

 

Added the license key - thanks.

It does update in other versions of the display - like the homepage products, just seems to have a delay on the recently viewed which doesn't seem to relate to caching on browser or server end (if I hard refresh and clear server cache that doesn't resolve the problem). Then if I leave it a while and come back it will be in the correct currency. Its frustrating to troubleshoot!

Ok!

Please  add  FTP access  I will add this to the adaptation queue

Added, thanks

Hello

I added this plugin to the adaptation queue

I will write to you as soon as I get the result

 

Hello

In  file -"\wp-content\themes\xstore\framework\post-types\static-blocks.php" - change  code - https://share.pluginus.net/image/i20210528200003.png

$current_currency="";
if (class_exists('WOOCS')) {
global $WOOCS;
$current_currency = $WOOCS->current_currency;
}
$output = wp_cache_get( $id.$current_currency, 'etheme_get_block' );

AND  change  this  code - https://share.pluginus.net/image/i20210528200110.png

$current_currency="";
if (class_exists('WOOCS')) {
global $WOOCS;
$current_currency = $WOOCS->current_currency;
}
wp_cache_add( $id.$current_currency, $output, 'etheme_get_block' );

and  do  a  test  please

Hi Pablo,

Apologies for the delay on this - I was on another part of the project for a while. I've got this code in place on the dev site and it just seems to force it back to my base currency when I try to switch?

(link is in my original post)

This is the current code for that file:

<?php if ( ! defined('ETHEME_FW')) exit('No direct script access allowed');
// **********************************************************************//
// ! Static Blocks Post Type
// **********************************************************************//

if(!function_exists('etheme_get_static_blocks')) {
function etheme_get_static_blocks ($s = '') {
$return_array = array();
$args = array( 'post_type' => 'staticblocks', 'posts_per_page' => -1, 's'=> $s );

$myposts = get_posts( $args );
$i=0;
foreach ( $myposts as $post ) {
$i++;
$return_array[$i]['label'] = $post->post_title;
$return_array[$i]['value'] = $post->ID;
}
wp_reset_postdata();

return $return_array;
}
}

// **********************************************************************//
// ! Get Static Blocks
// **********************************************************************//
if ( ! function_exists( 'etheme_static_block' ) ) {
function etheme_static_block($id = false, $echo = false){
if( ! $id ) return;
global $post;

// ! Check post password_required
if ( post_password_required( $id ) ) {
echo get_the_password_form( $id );
return;
}

$edit_mode = (isset($_GET['action']) && $_GET['action'] == 'elementor');
// always is false but make delay to prevent fatal error for get_query_var in $et_options

$cache = false;
if ( !$edit_mode ) {
$cache = etheme_get_option( 'static_block_cache', 1 );
}

$output = false;

if ( $cache ) {

$current_currency="";
if (class_exists('WOOCS')) {
global $WOOCS;
$current_currency = $WOOCS->current_currency;
}
$output = wp_cache_get( $id.$current_currency, 'etheme_get_block' );
}

if ( ! $output ) {
$args = array( 'include' => $id,'post_type' => 'staticblocks', 'posts_per_page' => 1);
$output = '';
$myposts = get_posts( $args );
foreach ( $myposts as $block ) {
setup_postdata($block);

if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
$elementor_instance = Elementor\Plugin::instance();
$output = $elementor_instance->frontend->get_builder_content_for_display( $block->ID );
}

if ( $output == '' ) {
$shortcodes_custom_css = '';
$is_wpb = false;
if ( class_exists('WPBMap') && method_exists('WPBMap', 'addAllMappedShortcodes')){
WPBMap::addAllMappedShortcodes();
$is_wpb = true;
}
$output = do_shortcode( $block->post_content );

$shortcodes_custom_css .= get_post_meta( $block->ID, '_wpb_shortcodes_custom_css', true );

if ( $is_wpb ) {
$css = array(
'global' => array(),
'md' => array(),
'sm' => array(),
'xs' => array(),
);

$css2 = et_custom_shortcodes_css( $block->post_content );

if ( is_array( $css2 ) ) {
$css = array(
'global' => array_merge( $css['global'], $css2['global'] ),
'md' => array_merge( $css['md'], $css2['md'] ),
'sm' => array_merge( $css['sm'], $css2['sm'] ),
'xs' => array_merge( $css['xs'], $css2['xs'] ),
);
}

$css = array(
'global' => array_unique( $css['global'] ),
'md' => array_unique( $css['md'] ),
'sm' => array_unique( $css['sm'] ),
'xs' => array_unique( $css['xs'] ),
);

if ( count( $css['global'] ) ) {
$shortcodes_custom_css .= implode( '', $css['global'] );
}

if ( count( $css['md'] ) ) {
$shortcodes_custom_css .= '@media only screen and (max-width: 1199px) {' . implode( '', $css['md'] ) . '}';
}

if ( count( $css['sm'] ) ) {
$shortcodes_custom_css .= '@media only screen and (max-width: 768px) {' . implode( '', $css['sm'] ) . '}';
}

if ( count( $css['xs'] ) ) {
$shortcodes_custom_css .= '@media only screen and (max-width: 480px) {' . implode( '', $css['xs'] ) . '}';
}
}

if ( ! empty( $shortcodes_custom_css ) ) {
$output .= '<style data-type="vc_shortcodes-custom-css">' . $shortcodes_custom_css . '</style>';
}
}
}
wp_reset_postdata();

if ( $cache ) {
$current_currency="";
if (class_exists('WOOCS')) {
global $WOOCS;
$current_currency = $WOOCS->current_currency;
}
wp_cache_add( $id.$current_currency, $output, 'etheme_get_block' );
}
}

if ( $echo ) {
echo wp_specialchars_decode($output);
} else {
return wp_specialchars_decode($output);
}
}
}

// **********************************************************************//
// ! Ajax get Static Blocks
// **********************************************************************//
add_action( 'wp_ajax_et_ajax_get_static_blocks', 'et_ajax_get_static_blocks' );
if ( ! function_exists('et_ajax_get_static_blocks')) {
function et_ajax_get_static_blocks(){
$s = '';
if (isset($_REQUEST['search'])){
$s= $_REQUEST['search'];
}

$static_blocks = etheme_get_static_blocks($s);
$return = array();
foreach ($static_blocks as $key => $value) {
$return[] = array(
'id' => $value['value'],
'text' => $value['label']
);
}
wp_send_json($return);
}
}

 

Hello

it just seems to force it back to my base currency when I try to switch? - This code cannot cause this behavior

Please  update  the   plugin  to latest  version - https://currency-switcher.com/how-to-make-auto-update-for-wordpress-plugins-and-themes-bought-on-envato/

Could it be anything to do with Geolocation? :)

We're on Version 2.3.4.1

Could it be anything to do with Geolocation? - No

We're on Version 2.3.4.1 - I know, and for this reason, please update the plugin to the latest version 2.3.5

I don't have direct access to the Envato account, is there another way to access the update.

, is there another way to access the update. - in this case contact envato support. You can get the new version of the plugin only on envato