how to add currency symbol suffix in woocommerce without using switch case

Viewed 275

The issue is that there are so many currencies and i don't want to write switch cases for each. Is there any walk-around from this.

What I tried

Saw this link:- WooCommerce Currency Symbol, https://www.codemyownroad.com/add-currency-code-suffix-prices-woocommerce, https://www.speakinginbytes.com/2014/04/currency-code-symbol-woocommerce

My Code

function addPriceSuffix($format, $currency_pos) {
    switch ( $currency_pos ) {
        case 'left' :
            $currency = get_woocommerce_currency();
            $format = '%1$s%2$s ' . $currency;
        break;
    }

    return $format;
}

add_action('woocommerce_price_format', 'addPriceSuffix', 1, 2);

But my problem didn't solve. Any plugin or any functionality that could help me with this.Thanks.

0 Answers
Related