Good afternoon.
We have a website using three currencies. Euros, Pounds Sterling and Dollars. The base currency is Euro. The conversion is done automatically.
On the cart page I want to display the price of the product in Euros and in the selected currency.
For example, a product costs 10 Euros. When selecting GBP I want to see: 10eur (8.52gbp).
The problem is that I can't get the price of the item in the base currency.
I understand what you're looking for. Please note that by default, the WooCommerce Multilingual plugin does not support displaying the base price alongside the converted price. Typically, it allows for the display of only one currency or price at a time for each language setting.
However, you can accomplish your goal with custom coding. I recommend referring to the WooCommerce Multilingual hook guide, which provides useful information for customizing the plugin to fit your needs. The guide below should assist you in implementing the desired functionality.
For your information, providing support for custom coding or solutions is beyond the scope of our support. Therefore, you can hire a professional developer, who specializes in custom WPML and its add-ons from here: https://wpml.org/contractors/
I hope you can understand. If there is anything else you need help with, please feel free to let me know. I will be happy to help.
Thank you for providing this information. It has been helpful. But now I have a different one, I can get the price in different currencies, but for the base currency the price is displayed wrong.
I will try to describe more details:
If the Euro currency is selected, the price is output correctly - 100 Euros,
If the currency selected is Dollar, the price is 120 Euros and in brackets the price is 109.14 dollars. The price in dollars is calculated correctly, but the price in euros should be 100. For some reason a 20% tax is added to the euro price. Although in the settings it is set to exclude tax
Thank you for the update. It's great to hear that you've successfully displayed both the base price and the converted price as intended.
Now, to better assist you with the issue that you're having, I need to understand how the base price alongside the converted price is being displayed on your website. In WooCommerce Multilingual, there isn't a default feature to show the base price with the converted price in this manner as you know. It leads me to believe that there might be custom code involved in your setup.
Could you please provide some insight into how this functionality was implemented? If custom coding was used to achieve this display, I'm sorry to inform you that providing support for custom-coded solutions or resolving issues arising from them is beyond the scope of our support. In such cases, it might be best to consult with the developer who implemented the custom code.
However, if this was set up using settings within WooCommerce or WooCommerce Multilingual, I would gladly assist. Please let me know where and how you've adjusted the settings related to currency display and conversion. This information will enable me to better understand your setup and guide you toward a potential solution.
If Euro currency is selected on the site, the price is displayed correctly (100 eur), but if you change the currency, the price will add tax and get 120eur.
At the same time the price in the selected currency is calculated correctly from 100eur and does not add tax.
To display the price I use this code:
$current_currency = get_woocommerce_currency();
The issue you're having in other currencies could be happening due to how the tax is being applied or displayed when the currency is switched from Euro to another currency on your site. Please nsure that your tax settings in WooCommerce are correctly configured. WooCommerce allows you to display prices either including or excluding tax, and this setting might be impacting how prices are displayed in different currencies.
Please also recheck the currency conversion logic. In the elseif and else blocks, you're using wc_price( $eur_price, array('currency' => 'EUR')). This might be causing an issue as it converts the Euro price to Euro again. Instead, it should probably convert the Euro price to the current currency.
If these suggestions do not resolve the issue, it may be due to specific aspects of your custom code. As providing support for custom coding is beyond the scope of our support, we recommend consulting with a professional developer who can delve deeper into the custom code aspects of your site.
For expert assistance, you can consider hiring a developer, who specializes in customizing WPML and its add-ons from here: https://wpml.org/contractors/. A professional developer will be able to review your code in detail and provide a tailored solution to address the issue you are facing.
If you have any more questions or need further assistance within our support scope, please feel free to reach out.
Best regards,
Prosenjit
The topic ‘[Closed] WCML. How to get the price in base currency on a page with another currency?’ is closed to new replies.