• Resolved hodgigre

    (@hodgigre)


    Tried adding numerous variations of GBYTE, byte, MG, and B for currency name and symbol by adding following to functions.php, but none work.

    I can only get payments to process if a native Woocommerce currency is selected under settings. I would like to display bytes or MB’s only.

    add_filter( ‘woocommerce_currencies’, ‘add_bb_currency’ );
    function add_bb_currency( $bb_currency ) {
    $bb_currency[‘byteball bytes’] = __( ‘byteball bytes’, ‘woocommerce’ );
    return $bb_currency;
    }
    add_filter(‘woocommerce_currency_symbol’, ‘add_bb_currency_symbol’, 10, 2);
    function add_bb_currency_symbol( $custom_currency_symbol, $custom_currency ) {
    switch( $custom_currency ) {
    case ‘byteball bytes’: $custom_currency_symbol = ‘B’; break;
    }
    return $custom_currency_symbol;
    }

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author boyington

    (@bottapress)

    Hi,

    You should define the ‘byteball bytes’ currency as follows :

    
    add_filter( 'woocommerce_currencies', 'add_bb_currency' );
    
    function add_bb_currency( $bb_currency ) {
        $bb_currency['B'] = __( 'byteball bytes', 'woocommerce' );
        return $bb_currency;
    }
    
    add_filter('woocommerce_currency_symbol', 'add_bb_currency_symbol', 10, 2);
    
    function add_bb_currency_symbol( $custom_currency_symbol, $custom_currency ) {
        switch( $custom_currency ) {
            case 'B': $custom_currency_symbol = 'Bytes'; break;
        }
        return $custom_currency_symbol;
    }
    

    I have tested it and it works.

    Thread Starter hodgigre

    (@hodgigre)

    Indeed it does. Clearly my coding attempts without really understanding the code left something to be desired. Beautiful.

    Plugin Author boyington

    (@bottapress)

    Hi hodgigre,

    be advised that the new 1.1.0 version of WooBytes plugin now adds the possibility to set Byteball Bytes, KBytes, MBytes or GBytes as main currency of your e-shop.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding byteball as a display currency’ is closed to new replies.