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

Wrong currency displayed.

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.

Hi, my site has a cache plugin and when configuring the currency switcher plugin I enabled the"I am using cache plugin on my site". However when I used the"[woocs_show_custom_price]" - it shows the price incorrect on the landing page (homepage) of the website. I use"[woocs_show_custom_price]" on the homepage to display several different custom prices, just for context. Then if I visit the shop, product and checkout page, the price of the products appear ok. So I'm just wondering why the"[woocs_show_custom_price]" doesn't show the correct currency if works for the other pages mentioned above?

Hello

Please  drop me  exact  link to  the  issue

What plugin version number are you using?

I'm using

v.2.4.3.1

Hello

Place please actual purchase code of the plugin into the private area of this ticket:
https://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.png

I've just added it now.

Any suggestions on  how to proceed to troubleshoot this?

Hello

Shortcode [woocs_show_custom_price] not belongs to any product, and redrawing is using product ID to take data by AJAX from server, recount price, then format price and back it on the front.

But your question is good, we juts created special script which you can apply in file functions.php of the current wp theme:

add_action('wp_footer', 'woocs_custom_price_cache_fix', 999);
function woocs_custom_price_cache_fix() {
    // Check if WOOCS is active
    if (!class_exists('WOOCS')) {
        return;
    }
    ?>
    <script >
    jQuery(document).ready(function($) {
        // Wait for WOOCS initialization
        setTimeout(function() {
            // Check if cache mode is enabled
            if (typeof woocs_shop_is_cached !== 'undefined' && woocs_shop_is_cached) {
                
                // Recalculate custom prices function
                function woocs_recalculate_custom_prices() {
                    jQuery('.woocs_amount_custom_price').each(function() {
                        var $item = jQuery(this);
                        var base_value = parseFloat($item.data('value'));
                        var decimals = parseInt($item.data('decimals'));
                        
                        if (isNaN(base_value)) {
                            return;
                        }
                        
                        // Convert to current currency
                        var converted_value = base_value * woocs_current_currency.rate;
                        
                        // Determine decimals
                        if (decimals === -1 || isNaN(decimals)) {
                            decimals = parseInt(woocs_current_currency.decimals);
                        }
                        
                        // Apply hide_cents setting
                        if (woocs_current_currency.hide_cents == 1) {
                            decimals = 0;
                        }
                        
                        // Format number
                        var price_formatted = converted_value.toFixed(decimals);
                        
                        // Apply separators
                        if (woocs_current_currency.separators ==="1") {
                            // European format: 1.234,56
                            price_formatted = price_formatted.replace('.', ',');
                            var parts = price_formatted.split(',');
                            parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, '.');
                            price_formatted = parts.join(',');
                        } else {
                            // American format: 1,234.56
                            var parts = price_formatted.split('.');
                            parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
                            price_formatted = parts.join('.');
                        }
                        
                        // Build HTML with currency symbol
                        var symbol = woocs_current_currency.symbol;
                        var position = woocs_current_currency.position;
                        var final_html = '';
                        
                        switch(position) {
                            case 'left':
                                final_html = symbol + price_formatted;
                                break;
                            case 'left_space':
                                final_html = symbol + '&nbsp;' + price_formatted;
                                break;
                            case 'right':
                                final_html = price_formatted + symbol;
                                break;
                            case 'right_space':
                                final_html = price_formatted + '&nbsp;' + symbol;
                                break;
                            default:
                                final_html = symbol + price_formatted;
                        }
                        
                        // Update inner span with class woocs_amount
                        $item.find('.woocs_amount').html(final_html);
                    });
                    
                    console.log('WOOCS custom prices recalculated');
                }
                
                // Run on page load
                woocs_recalculate_custom_prices();
                
                // Run on currency change
                jQuery(document).on('woocs_currencies_changed', function() {
                    setTimeout(woocs_recalculate_custom_prices, 100);
                });
            }
        }, 500);
    });
    </script>
    <?php
}

 

 

Hello

This fix is included into version 2.4.4/1.4.4