Cyrillic symbols in Product Archive and Single Product pages
-
Hello, I am trying to customize the price shown on product archive page. I use the following snippet, which works great:
function custom_price_string_on_archive_pages($price, $product) {
// Check if it’s an archive page (shop or product category/tag)
if (is_archive() || is_shop()) {
// Add “от ” in front of the price
$price = ‘от ‘ . $price;
}
return $price;
}
add_filter(‘woocommerce_get_price_html’, ‘custom_price_string_on_archive_pages’, 10, 2);
It adds “от ” in front of my lower price for variable products. Unfortunately the cyrillic symbols show as “??”. Not sure what might be causing this. Please let me know how I can resolve.
Attachments:
You must be
logged in to view attached files.
Hello,
Could you please check how it works with some default WordPress themes like TwentyTwenty or WooCommerce Storefront to understand is it our theme issue or not?
Regards
It is the same with twentytwentythree theme. Again shows “??”. I had Astra before and it was working well.. How can I fix this?
Attachments:
You must be
logged in to view attached files.
If it doesn’t work with other themes as well then it is not caused by WoodMart. Looks like something is wrong with your code or file encoding. But fixing such customizations is out of our theme support scope.
Kind Regards
The way I fixed this is downloading functions.php of the child theme. Opened with Notepad++, selected all text and from Encoding -> Convert to UTF-8. Then re-uploaded and worked like a charm.
Great, we are glad that you sorted it out! Feel free to contact us if you have any further questions.