Friday, May 24, 2013

Add currency in Woocommerce

Below code can be used to add currency in woo commerce (if it is not there by default)

add_filter( 'woocommerce_currencies', 'add_inr_currency' );
add_filter( 'woocommerce_currency_symbol', 'add_inr_currency_symbol' );
 
function add_inr_currency( $currencies ) {
    $currencies['INR'] = 'INR';
    return $currencies;
}
 //addedy by tanvi for adding INR Currency
function add_inr_currency_symbol( $symbol ) {
 $currency = get_option( 'woocommerce_currency' );
 switch( $currency ) {
  case 'INR': $symbol = 'Rs.'; break;
 }
 return $symbol;
}

Note: This is to Add INR (Indian Rs) Currency , same code can be used for any currency 

No comments:

Post a Comment