We tried the same code on our end with latest WPML and latest WooCommerce
we are also not able to format the base currency on our end the base currency do not follow any formatting done from the woocommerce and it do not have its own formation option so that is causing the issue in the base currency
since the issue is in WPML filter you will have to contact WPML for this
we are also doing check from our end will see if we can modify the code to detect base currency and do not implement filter for base currency that can solve the issue
Thread Starter
zla520
(@zla520)
Very strange, the above product prices are displayed normally, but your shipping currency format is not displayed correctly, I think the problem does not come from wpml.
Thread Starter
zla520
(@zla520)
If it is a WPML problem, then the product price format will also be displayed incorrectly.
Our plugin by default shows the shipping price next to the shipping method
but in your case you wanted to show the currency converted price which is done by this filter function apply_filters( ‘wcml_formatted_price’) => which is WPML code
and for some reason that code is not dong the conversion when the base currency is selected
as there filter function is doing incorrect conversion we are concluding issue is happening from that end
Thread Starter
zla520
(@zla520)
So for the product price, what filter does WPML use to change the currency? You can add a filter for the product price to the shipping cost.
We have used what was provided by them in there documentation, we will try to contact them and see what they say, will suggest you also contact them
Thread Starter
zla520
(@zla520)
I see that the shipping format is displayed correctly on the checkout page. Maybe we are using the wrong apply_filters. Is there any way to know what apply_filters are used on the checkout page?
https://babyamy.store/product/helloskin-hifu-machine
will contact WPML as we have no idea what function are used in WPML internally
you also contact them as you are there paid customer you will get fast support from them
Thread Starter
zla520
(@zla520)
I cannot get in touch with them because I am not a paying user. Is there a way to check which filter they use from the source code?
we are working on the code to detect base currency so we don’t use filter for the base currency
Thread Starter
zla520
(@zla520)
thanks for that we do have the WPML on our end we will let you know once we get the solution
Try this code (in this we are not running the filter function for base currency)
add_filter('pisol_ppscw_shipping_method_name', function($title, $rate){
$currency_code = get_woocommerce_currency_symbol();
$price = apply_filters( 'wcml_formatted_price', $rate->get_cost());
if(strpos($price, $currency_code) === false){
$title = $currency_code.' '.$rate->get_label().': '.$price;
}
return $title;
},10,2);
Thread Starter
zla520
(@zla520)
Very good, it works fine now. Thank you so much.