• Hi,

    please help, the theme creator adressed me to you…

    Who can i ask about the full code form for custom currency to inser in functions.php file and where exactly to insert it (to avoid mess:) :

    add_filter( ‘woocommerce_currencies’, ‘add_my_currency’ );

    function add_my_currency( $currencies ) {
    $currencies[‘ABC’] = __( ‘Currency name’, ‘woocommerce’ );
    return $currencies;
    }

    add_filter(‘woocommerce_currency_symbol’, ‘add_my_currency_symbol’, 10, 2);

    function add_my_currency_symbol( $currency_symbol, $currency ) {
    switch( $currency ) {
    case ‘ABC’: $currency_symbol = ‘$’; break;
    }
    return $currency_symbol;
    }

    Thank you in advance.

    Best regards!

    https://ww.wp.xz.cn/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    What are you struggling with?

    https://docs.woothemes.com/document/add-a-custom-currency-symbol/

    functions.php of your theme is ideal, or create a custom plugin.

    Thread Starter mina888

    (@mina888)

    Hi,

    saw it, even watched a step by step video.

    When i add the (adapted) code the site crushes…

    Thank you in advance for further instructions if any ideas

    Best regards

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Post your adapted code within backticks ` so I can check it.

    Thread Starter mina888

    (@mina888)

    add_filter( ‘woocommerce_currencies’, ‘add_my_currency’ );

    function add_my_currency( $currencies ) {
    $currencies[‘ABC’] = __( ‘Srpski Dinar’, ‘woocommerce’ );
    return $currencies;
    }

    add_filter(‘woocommerce_currency_symbol’, ‘add_my_currency_symbol’, 10, 2);

    function add_my_currency_symbol( $currency_symbol, $currency ) {
    switch( $currency ) {
    case ‘ABC’: $currency_symbol = ‘RSD’; break;
    }
    return $currency_symbol;
    }

    ………………….
    Hope this is good

    Thank you in advance

    Best regards!

    Plugin Contributor Mike Jolley

    (@mikejolley)

    ‘ABC’ should be your currency code.

    If you place this in functions.php, ensure its within <?php ?> tags (they may already be defined).

    The rest looks ok.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘custom language’ is closed to new replies.