WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to add currency (Pakistani - PKR) (5 posts)

  1. barzakh
    Member
    Posted 1 year ago #

    Hi

    I just installed woocommerce and wish to add Pakistani currency (PKR) to the list of currencies. I see Pakistan in the list of countries but not currency.. so please do suggest how to do that, and sooner the better.
    thanks

    http://wordpress.org/extend/plugins/woocommerce/

  2. terrytsang
    Member
    Posted 1 year ago #

    Hi, you can try below code:

    add_filter( 'woocommerce_currencies', 'add_custom_currency' );
    function add_custom_currency( $currencies ) {
      $currencies["PKR"] = 'Pakistani Rupee';
      return $currencies;
    }
    
    add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2);
    function add_custom_currency_symbol( $currency_symbol, $currency ) {
    switch( $currency ) {
      case 'PKR': $currency_symbol = 'Rs.'; break;
    }
    return $currency_symbol;
    }
  3. barzakh
    Member
    Posted 1 year ago #

    thanks! this worked great, added it in the middle of my functions.php theme file :)

  4. Shafan Hameed
    Member
    Posted 1 year ago #

    Hi terrytsan. i try this one but it says "Parse error: syntax error, unexpected T_STRING". can you define where to put it ?

  5. terrytsang
    Member
    Posted 1 year ago #

    Hi Shafan, you can add the code in your theme function.php file.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic