Code-Snippets-Functions/Execute a function on a child site/WooCommerce/display-currency-suffix-cart-checkout.txt
2023-05-04 14:04:50 -06:00

18 lines
398 B
Text

add_filter( 'woocommerce_price_format', 'add_currency_suffix', 10, 2 );
function add_currency_suffix( $price, $currency_symbol ) {
// Only add the suffix on cart and checkout pages
if ( is_cart() || is_checkout() ) {
// Get the current currency code
$currency = get_woocommerce_currency();
// Add the suffix to the price
$price .= ' ' . $currency;
}
return $price;
}