YITH product add-on used to work perfectly with FOX(previously WOOCS) multi-currency. However now the add-ons with price change does not seem to be working. With price change add-ons the base price figure does not change as per the exchange rate in FOX but the currency symbol changes. Also, the base price of the main product itself shows as 0 in the cart when not in base currency of the store. (The same issue persists with WooCommerce Multilingual & Multicurrency plugin by Onthegosystems)
Could you please look into it and update me on a possible resolve?
Thank you!
I hope this message finds you well. I am utilizing the pro version of this plugin and has successfully implemented a currency switcher on the checkout page using the following code placed within the functions.php
file. The setup is functioning seamlessly on the /checkout/
page:
// Add a custom select field in checkout
add_action('woocommerce_before_checkout_billing_form', 'add_custom_checkout_select_field');
function add_custom_checkout_select_field( $checkout ) {
// Here set in the function your product category term ID, slugs, names or array
if ( ! has_product_category_in_cart( 'concierge' ) && 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
add_filter('wp_head',function(){
if(!is_checkout()){
global $WOOCS;
$WOOCS->reset_currency();
}
});
However, the website is not a standard WooCommerce setup. The single product page has been customized, incorporating a third-party gadget that dynamically updates prices akin to the hotel industry. Upon adding a product to the cart, it defaults to USD due to WooCommerce settings, whereas their gadget provides a currency switcher functionality.
To address this, I’ve implemented cookies with the name “Usr5electedCurr3ncy” to store the selected currency from third-party gadget. The challenge arises when attempting to read this cookie value and pass it to the Woocs gadget on the checkout page. The JavaScript code below is intended to select the currency based on the cookie value. Yet, it only sets but doesn’t switch the Woocs currency selector as intended. Manually selecting a currency from the dropdown works seamlessly.
document.addEventListener('DOMContentLoaded', function() {
const selectElement = document.querySelector('select[name="woocommerce-currency-switcher"]');
// Function to get the value of the specified cookie
function getCookie(name) {
const cookies = document.cookie.split('; ');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].split('=');
if (cookie[0] === name) {
return cookie[1];
}
}
return null;
}
// Get the value of 'Usr5electedCurr3ncy' cookie
const selectedCurrency = getCookie('Usr5electedCurr3ncy');
if (selectedCurrency) {
// Loop through options to find and select the matching currency
for (let i = 0; i < selectElement.options.length; i++) {
if (selectElement.options[i].value === selectedCurrency) {
selectElement.value = selectedCurrency;
break;
}
}
}
});
I seek your expertise in resolving this issue. I aim to set the currency based on the cookie and enable the switch in checkout information, allowing customers to transact in their selected currency rather than defaulting to USD. Your guidance in this matter would be greatly appreciated.
Thank you for your time and assistance.
]]>I have found the solution on your forum Fox doesn’t work while WP Rocket is active – Support Forum – PluginUs.Net, but this solution is not great for big store. What it does is that it completely disable cache when PHPSESSID cookie is present. So it completely disable cache for whole site when you have the switcher in page menu for example.
I would love some better and working solution. What happen is, that sometimes you change the language with dropdown and nothing happen, unless you do that second or third time again. Can you please provide working solution, which doesnt disable cache on our shop completely?
]]>Once we add Bundled product to the cart and go to the PAY age, price is getting doubled… Usually it happens when we go to the foreign language page. But even if we go back from foreign to original language, price stays doubled…
Looks like there is a big bug.
]]>We are using Woocs currency swither and Tiered Pricing together.
There is a problem with the Product Summary Price Calculation.
The rest of the page works fine, however only the Summary section shows wrong currency.
Is there any solution to this problem?
We bought the Plugin but we cannot use it, therefore we have to return the product if that is not going to work.
Thank you for your help in advance.
Burak Gülay
]]>I am using the redis, so I set it up also in settings.
I am also using this for translatepress:
add_filter('wp_head', function() {
$lang = get_locale();
global $WOOCS;
switch ($lang)
{
case 'en_GB':
$WOOCS->set_currency('EUR');
break;
default:
$WOOCS->set_currency('CZK');
break;
}
});
I thought it is caused by WP Rocket, but after disabling it, problem stays. What should I do?
]]>We have Woocommerce and WooCommerce Currency Switcher installed on our platform
We notice that your plugin has some kind of conflict with WOOCS
The price show fine in our website but once added to cart the price is somehow increased
Best regards
]]>