Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Andrey 3 months, 2 weeks ago.

Assisted by: Andrey.

Author Posts
July 26, 2024 at 10:43 am #16008125

romanV-9

Background of the issue:
I am trying to use the wcml_rounded_price() function to handle rounding of the prices of the products. The function looks like this:

add_filter('wcml_rounded_price', 'wcmlhook_rounded_price', 10, 2);

function wcmlhook_rounded_price($price, $currency)
{
    if ('CZE' == $currency && $price > 10000) {
        $price = ceil($price);
    }
    error_log("Hello World");
    error_log($price);
    error_log($currency);
    return $price + 12.50;
}

Link to a page where the issue can be seen: hidden link

Symptoms:
The price does not change. Function is called but the return value is not displayed as the price of the product.

Questions:
Why is the return value of wcml_rounded_price() not displayed as the price of the product?
Is there a specific reason why the price is not visible despite the function being called?

July 29, 2024 at 7:55 pm #16017842

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for contacting WPML support.

Could you provide some examples to illustrate the issues you are experiencing?

Additionally, have you attempted to verify by using a simple code snippet from the following link? Is CZE the second currency?

I believe that the currency code for the Czech Koruna is CZK.