Saltar navegación

Este hilo está resuelto. Aquí tienes una descripción del problema y la solución.

Problem:
If you're experiencing issues with WPML Multicurrency for specific Booking products and Accommodation bookings, and you want to deactivate the multicurrency option and set the original currency (Brazilian Real) based on the product ID, we understand your concern.
Solution:
We recommend the following steps:
1. Hide the price for the specific product (e.g., product ID 1234).
2. Use a hook like

'wcml_product_price_by_currency'

to add a custom price in the original currency.
Please review the documentation for the

'wcml_product_price_by_currency'

hook here: https://wpml.org/wcml-hook/wcml_product_price_by_currency/.
Additionally, you can explore our hooks directory for other codes that might be suitable for your project: https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/.

Please note that custom coding is beyond our support scope, and it's your responsibility to maintain any custom code you implement. For more information on our support policy, please visit: https://wpml.org/purchase/support-policy/.

If this solution doesn't seem relevant to your situation, please feel free to open a new support ticket with us for further assistance.

Este es el foro de soporte técnico de WPML, el plugin multilingüe de WordPress.

Todas las personas pueden leerlo pero solo los clientes de WPML pueden ingresar comentarios. El equipo de WPML responde en los foros 6 días a la semana, 22 horas por día.

Etiquetado: 

Este tema contiene 1 respuesta, tiene 2 voces.

Última actualización por Mateus Getulio hace 1 año.

Asistido por: Mateus Getulio.

Autor Entradas
diciembre 5, 2023 en 4:40 pm #15000991

annas-27

I have Booking products and Booking accommodations that I don't want to have the option of WPML Multicurrency. Is there a way to deactivate and only set the original currency for those products? Can you create a JavaScript that deactivates multicurrency and sets the original currency, which is the Brazilian Real, based on the product ID?

enlace oculto

Would this script work?

javascript
Copy code
function disable_currency_conversion(product_id, currency) {
// Check if the product has the specified ID
if (product_id == 1234) {
// Disable currency conversion
return false;
}

// If the product does not have the specified ID, allow currency conversion
return true;
}

add_filter('woocommerce_product_get_price_html', 'disable_currency_conversion', 10, 2

muchas gracias

diciembre 5, 2023 en 9:15 pm #15002763

Mateus Getulio
Supporter

Idiomas: Inglés (English ) Portugués, Brasil (Português )

Zona horaria: America/Sao_Paulo (GMT-03:00)

Hello there,

Thanks for your contact!

Please note that there is not a straightforward and native way to achieve this from WooCommerce Multilingual settings.

A possible alternative would be to follow these steps:

- Hide the price for product 1234
- Use a hook like 'wcml_product_price_by_currency' to add a custom price.

Please check the documentation for the 'wcml_product_price_by_currency' hook here: https://wpml.org/wcml-hook/wcml_product_price_by_currency/.

You may also explore our hooks directory for other codes that might be more useful for your project: https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

Note: the possible solution provided is to be used just as an informational one. Please remember that custom coding is out of the scope of our support, so we can't create, debug or modify code for you and it's your responsibility to maintain it. We hope the one we used as an example could point you in the right direction. Please check our support policy: https://wpml.org/purchase/support-policy/

Thanks for your understanding. If you need anything else don't hesitate to contact us.