Reputation: 1743
How I will display woocommerce price in my local currency ( 0 = ০. 1=১. 2=২. 3= ৩. 4=৪. 5=৫. 6=৬. 7= ৭. 8=৮, etc) BDT using a function without any warning I am using WordPress cms with woocommerce
Upvotes: 3
Views: 147
Reputation: 2027
You should use a filter for that. Usually the filter to show prices is wc_price, so you can use this filter, for example:
add_filter( 'wc_price', 'replace_digits', 99, 4);
function replace_digits( $return, $price, $args, $unformatted_price ){
$price_string = (string)$unformatted_price;
$price_string = str_replace('1', 'A', $price_string);
$price_string = str_replace('2', 'B', $price_string);
$price_string = str_replace('3', 'C', $price_string);
$price_string = str_replace('4', 'D', $price_string);
$price_string = str_replace('5', 'E', $price_string);
$price_string = str_replace('6', 'F', $price_string);
$price_string = str_replace('7', 'G', $price_string);
$price_string = str_replace('8', 'H', $price_string);
$price_string = str_replace('9', 'I', $price_string);
$price_string = str_replace('9', 'J', $price_string);
return $price_string;
}
Upvotes: 1