Skip to content

Instantly share code, notes, and snippets.

@ivandoric
Created April 23, 2014 15:11
Show Gist options
  • Save ivandoric/11219283 to your computer and use it in GitHub Desktop.
Save ivandoric/11219283 to your computer and use it in GitHub Desktop.
woocommerce: Add new currency to WooCommerce
<?php
// Just add it to functions.php
// Add currency / symbol
add_filter( 'woocommerce_currencies', 'add_rand_currency' );
add_filter( 'woocommerce_currency_symbol', 'add_rand_currency_symbol' );
function add_rand_currency( $currencies ) {
$currencies['HRK'] = __( 'Hrvatska kuna (Kn)', 'woothemes' );
return $currencies;
}
function add_rand_currency_symbol( $symbol ) {
$currency = get_option( 'woocommerce_currency' );
switch( $currency ) {
case 'HRK': $symbol = 'Kn'; break;
}
return $symbol;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment