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

Currency Switcher is not working after enabling Breeze and Cloudflare Enterprise

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.

Dear Support Team,

I am experiencing an issue with the FOX - Currency Switcher Professional for WooCommerce (WOOCS) plugin on my site after enabling the Breeze cache plugin and Cloudflare Enterprise. The currency switcher functionality is not working as expected.

Here are the details of my current configuration:

  • Currency Aggregator: Yahoo Finance
  • Currency Storage: FOX Session
  • Rate Auto Update: Twice daily
  • I am using cache plugin on my site: Enabled
  • Cache: Breeze, Cloudflare Enterprise, Varnish, Redis Cache
  • Server: Digital Ocean Cloudways

I have added the following paths under the"never cache" settings:

/(cart|my-account/(.*)|checkout|wc-api/(.*)|addons|logout|lost-password|product/(.*)|wp-admin|wp-login)/
/wp-content/plugins/woocommerce-currency-switcher/js/
/wp-content/plugins/woocommerce-currency-switcher/js/*

However, the issue persists. You can see the problem on this page after searching for specific dates, adding the product to the cart, and going to the checkout page.

Please advise if any additional changes or configurations are required to resolve this issue.

I would greatly appreciate your assistance in getting the currency switcher to work correctly with the caching setup.

Thanks,
Prince

I am unable to edit this support ticket. Could you please remove the hyperlink from the"on this page" section? It should be a private hyperlink.

Hello

Can you create video with the issue?

If you mean these prices - https://c2n.me/4kXGvxx.png - These are the prices generated by a third-party plugin. The function of redrawing cached prices does not work with custom prices

Hello,

Thanks for removing the hyperlink, I've updated the loom video recording in the topic private data section.

Below is the code used in the child theme functions.php

/* CURRENCY FIELD CHECKOUT */
// Utility function that checks if at least a cart items remains to a product category
function has_product_category_in_cart( $product_category ) {
// Loop through cart items
foreach ( WC()->cart->get_cart() as $cart_item ) {
// If any product category is found in cart items
if ( has_term( $product_category, 'product_cat', $cart_item['product_id'] ) ) {
return true;
}
}
return false;
}

add_action('woocommerce_before_checkout_billing_form', 'add_custom_checkout_select_field');
function add_custom_checkout_select_field( $checkout ) {
if ( shortcode_exists( 'woocs' ) ) {
echo '<label for="payment_option" class="payment_option">'.__('Preferred currency').'</label>';
echo '<div class="own">' . do_shortcode('[woocs]') . '</div>';
}
}

// Custom Checkout fields validation
add_action('woocommerce_checkout_process', 'custom_checkout_select_field_validation');
function custom_checkout_select_field_validation() {
if ( isset($_POST['payopt']) && empty($_POST['payopt']) )
wc_add_notice( '<strong>Please select a currency</strong>', 'error' );
}

/* RESET CURRENCY SELECTOR IF IT'S NOT CHECKOUT PAGE */
add_filter('wp_head',function(){
if(!is_checkout()){
global $WOOCS;
$WOOCS->reset_currency();
}
});

Hello

This looks like a double conversion. This is a conflict with a third party plugin that changes prices.

Please read this - https://currency-switcher.com/woocs-labs

 

Hi,

This is the only plugin I am using for the currency conversion.

Hello

Ok! I see something similar to a booking plugin. Please disable it and do a test.

Hello,

I've identified that the plugin was causing issues when used with WooCommerce and Gravity Forms, particularly when specific products were involved.

To address this, I've implemented a conditional check using if ( ! has_product_category_in_cart( 'category_name_where_using_gravity_form' ) && shortcode_exists( 'woocs' ) ) This ensures that this plugin is only disabled when products from the"concierge" category are present in the cart and the woocs shortcode is detected. This approach effectively resolves the conflict while maintaining currency conversion functionality for other products where I am not using gravity forms.

This modification fixes the issue, and everything is working smoothly now.

Ok!  Great!