I am using Woocommerce. And I need through the functions.php file, change the value of the symbol "priceCurrency": "UAH"
, to "priceCurrency": "UAH2
".
I understand that this is not correct for the schema. But I need to test! Option through the admin panel is not suitable, since. I need so.
How to transfer the value to change the character?
I use Polylang to transform my pages, and so it would be necessary that the store be in different languages with different currencies of the corresponding page. For this, I used such code to change the translation for different pages.
function add_my_currency( $currencies ) {
$currencies['UAH '] = __( 'Українська гривня', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
function add_my_currency_symbol( $currency_symbol, $currency) {
$my_lang = pll_current_language(); // polylang
if ( $my_lang == 'en' ) {
$grn =' EUR ';
} else {
$grn =' грн ';
}
switch( $currency ) {
case 'UAH': $currency_symbol = $grn; break;
break;
}
return $currency_symbol;
}
add_filter('woocommerce_variable_price_html', 'mycustom_variation_price', 10, 2);
add_filter('woocommerce_variable_sale_price_html', 'mycustom_variation_price', 10, 2 );
It worked great and in different languages I saw different currencies. But when I looked at the source code for the schema markup. I saw that UAH did not change to EUR.
[{"@type":"Offer","price":"7046","priceSpecification":{"price":"7046","priceCurrency":"UAH","valueAddedTaxIncluded":"false"},"priceCurrency":"UAH"