How to display currency symbol before price and currency initials after price
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from txtcoke on January 5, 2022, 16:05Hello, how can I display currency symbol before price and currency initials after price?
For instance:
I want aud prices to show like:
$20 AUD
I cant find a way to display the initials after price. All I can do is all info before price, or all after, like $AUD 20 or 20 $AUD
Please help me to achieve this. (I own premium)
Thanks
Hello, how can I display currency symbol before price and currency initials after price?
For instance:
I want aud prices to show like:
$20 AUD
I cant find a way to display the initials after price. All I can do is all info before price, or all after, like $AUD 20 or 20 $AUD
Please help me to achieve this. (I own premium)
Thanks
Quote from Pablo Borysenco on January 6, 2022, 11:11Hello
Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png
Try to use this field - https://c2n.me/4ex0O6t.png
Hello
Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png
Try to use this field - https://c2n.me/4ex0O6t.png
Quote from txtcoke on January 6, 2022, 13:44Thanks. Just added my license into the box.
It worked but I just want this field to work for AUD and USD.
Is there a snippet for this?
Thanks. Just added my license into the box.
It worked but I just want this field to work for AUD and USD.
Is there a snippet for this?
Quote from Pablo Borysenco on January 7, 2022, 12:14Hello
in this case you need to customize the code
this hook
An example:
add_action('woocommerce_get_price_html', function($price_html, $product){
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Hello
in this case you need to customize the code
this hook
An example:
add_action('woocommerce_get_price_html', function($price_html, $product){
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Quote from txtcoke on January 7, 2022, 20:04Thank you Pablo.
Tried to implement this snippet and it partially worked.
The issue is that the currency code returns in duplicate in the frontend.
What is expected from the snippet:
$ 20 AUD
What is happening:
$20 AUDAUD
The string is returning in duplicate, in other words, instead of only displaying AUD once, it is displaying twice.
The same happens for USD.
How can I solve this duplicate?
Thanks
ps: The custom price format field is empty, back to plugin default as I just want it to behave like this for AUD and USD.
Thank you Pablo.
Tried to implement this snippet and it partially worked.
The issue is that the currency code returns in duplicate in the frontend.
What is expected from the snippet:
$ 20 AUD
What is happening:
$20 AUDAUD
The string is returning in duplicate, in other words, instead of only displaying AUD once, it is displaying twice.
The same happens for USD.
How can I solve this duplicate?
Thanks
ps: The custom price format field is empty, back to plugin default as I just want it to behave like this for AUD and USD.
Quote from Pablo Borysenco on January 10, 2022, 11:05Hello
Try to add code - https://c2n.me/4eysrcs.png
if ( stripos('AUD', $price_html) !== false || stripos('USD', $price_html) !== false){
return $price_html;
}
Hello
Try to add code - https://c2n.me/4eysrcs.png
if ( stripos('AUD', $price_html) !== false || stripos('USD', $price_html) !== false){
return $price_html;
}
Quote from txtcoke on January 10, 2022, 13:06Thanks Pablo. I added it, result is the same as previous. Nothing changed.
Have you tested it on your end?
Thanks
Thanks Pablo. I added it, result is the same as previous. Nothing changed.
Have you tested it on your end?
Thanks
Quote from Pablo Borysenco on January 11, 2022, 10:25Hello
Please drop me a screenshot of the code
Hello
Please drop me a screenshot of the code
Quote from txtcoke on January 11, 2022, 22:35First one I tried:
add_action('woocommerce_get_price_html', function($price_html, $product){
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
First one I tried:
add_action('woocommerce_get_price_html', function($price_html, $product){
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Quote from txtcoke on January 11, 2022, 22:38Second one I tried:
add_action('woocommerce_get_price_html', function($price_html, $product){
if ( stripos('AUD', $price_html) !== false || stripos('USD', $price_html) !== false){
return $price_html;
}
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Both results are the same, AUDAUD or USDUSD instead of only once.
Second one I tried:
add_action('woocommerce_get_price_html', function($price_html, $product){
if ( stripos('AUD', $price_html) !== false || stripos('USD', $price_html) !== false){
return $price_html;
}
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Both results are the same, AUDAUD or USDUSD instead of only once.
Quote from Pablo Borysenco on January 12, 2022, 11:06Hello
Ok! just for test try this code
add_action('woocommerce_get_price_html', function($price_html, $product){
if ( stripos('+', $price_html) !== false || stripos('-', $price_html) !== false){
return $price_html;
}
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='+';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='-';
}
return $price_html;
}, 1, 2);
Hello
Ok! just for test try this code
add_action('woocommerce_get_price_html', function($price_html, $product){
if ( stripos('+', $price_html) !== false || stripos('-', $price_html) !== false){
return $price_html;
}
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='+';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='-';
}
return $price_html;
}, 1, 2);
Quote from txtcoke on January 12, 2022, 11:38Have you tested those snippets?
I ve just tested it and the result of this one is: $20++
Have you tested those snippets?
I ve just tested it and the result of this one is: $20++
Quote from Pablo Borysenco on January 12, 2022, 13:34Ok! try it please
add_action('woocommerce_get_price_html', function($price_html, $product){
$price_html = str_replace(['USD', 'AUD'], ['',''], $price_html);
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Ok! try it please
add_action('woocommerce_get_price_html', function($price_html, $product){
$price_html = str_replace(['USD', 'AUD'], ['',''], $price_html);
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html.='AUD';
} elseif ('USD' == $WOOCS->current_currency){
$price_html.='USD';
}
return $price_html;
}, 1, 2);
Quote from txtcoke on January 12, 2022, 13:45Just tested it...
same result...
Just tested it...
same result...
Quote from Pablo Borysenco on January 13, 2022, 12:52Hello
Try it:
add_action('woocommerce_get_price_html', function($price_html, $product){
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html = str_replace('</bdi>', '</bdi>AUD', $price_html);
} elseif ('USD' == $WOOCS->current_currency){
$price_html = str_replace('</bdi>', '</bdi>USD', $price_html);
}
return $price_html;
}, 1, 2);
Hello
Try it:
add_action('woocommerce_get_price_html', function($price_html, $product){
global $WOOCS;
if ('AUD' == $WOOCS->current_currency) {
$price_html = str_replace('</bdi>', '</bdi>AUD', $price_html);
} elseif ('USD' == $WOOCS->current_currency){
$price_html = str_replace('</bdi>', '</bdi>USD', $price_html);
}
return $price_html;
}, 1, 2);
Quote from txtcoke on January 13, 2022, 13:04It worked!
The only thing now is that "AUD" and "USD" are not passed along in mini cart or cart pages.
It displays correctly on the homepage and product pages.
Why is so?
Thanks
It worked!
The only thing now is that"AUD" and"USD" are not passed along in mini cart or cart pages.
It displays correctly on the homepage and product pages.
Why is so?
Thanks
Quote from Pablo Borysenco on January 14, 2022, 12:18Hello
Please drop me a link to your site
Hello
Please drop me a link to your site