Reputation: 121
I want to remove the currency symbol from my webshop, except on the shopping-cart page and the checkout.
So I do NOT want a currency symbol on:
But I DO want the currency symbol on:
I have been given this code:
function avia_remove_wc_currency_symbol( $currency_symbol, $currency ) {
if ( !is_cart() || !is_checkout()){
$currency_symbol = '';
return $currency_symbol;
}
}
add_filter('woocommerce_currency_symbol', 'avia_remove_wc_currency_symbol', 10, 2);
Which removes the currency symbol from all pages. It doesn't make it reappear on the shopping cart or checkout pages.
Upvotes: 1
Views: 5733
Reputation: 254231
If you want to display the currency symbol on view order pages (My account) and on email notifications too, you should do it this way:
add_filter('woocommerce_currency_symbol', 'avia_remove_wc_currency_symbol', 10, 2);
function avia_remove_wc_currency_symbol( $currency_symbol, $currency ) {
if ( is_shop() || is_product() || is_product_category() || is_product_tag() )
$currency_symbol = '';
return $currency_symbol;
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Tested and works
Is also better to let the
$currency_symbol
argument (defined in Woocommerce settings or with somme multi currency plugins) to have the hand where it needs to be shown and not handwrite it in the filter.
Upvotes: 1
Reputation: 1354
Try this:
<?php
function avia_remove_wc_currency_symbol( $currency_symbol, $currency )
{
$currency_symbol = '';
if ( is_cart() || is_checkout())
$currency_symbol = '$';
return $currency_symbol;
}
add_filter('woocommerce_currency_symbol', 'avia_remove_wc_currency_symbol', 10, 2);
?>
Upvotes: 2