Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom currency #7

Closed
byronrode opened this issue Sep 19, 2011 · 2 comments
Closed

Add custom currency #7

byronrode opened this issue Sep 19, 2011 · 2 comments

Comments

@byronrode
Copy link

Just going through the plugin, and testing on an install, but noticed there is no way to add a custom currency, for example. South African Rand, it is not supported by PayPal, but it will be supported by Paygate, which I am writing the gateway for.

There is a filter for woocommerce_currencies but nothing I do to that filter seems to work correctly.

@mikejolley
Copy link
Member

I've just committed a change so that the settings are not loaded until admin_init - this should allow you to hook in and add your currency.

@byronrode
Copy link
Author

Thanks Mike, works perfectly. For reference:

// Add ZAR Currency to WooCommerce
add_filter('woocommerce_currencies', 'bt_add_zar');
add_filter('woocommerce_currency_symbol', 'bt_add_zar_symbol');
function bt_add_zar($currencies){
    $currencies['ZAR'] = __('South African Rand (R)', 'woothemes');
    return $currencies;
}

function bt_add_zar_symbol($symbol){
    $currency = get_option('woocommerce_currency');
    switch($currency):
        case 'ZAR': $symbol = 'R'; break;
    endswitch;
    return $symbol;
}

mikejolley added a commit that referenced this issue Jun 1, 2015
mikejolley added a commit that referenced this issue Jun 1, 2015
@rccess rccess mentioned this issue Jun 1, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants