Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @eugyenoch,

    Thank you for reaching out with this message. Currently, this isn’t possible, however we’ll release an update the following days, probably right after Christmas, that will have a way to programmatically register new currencies.

    Once the update is live I’ll get back here with details on how you can add Bitcoin, or other custom currencies.

    All the best,
    Mihai

    Thread Starter D U Enoch

    (@eugyenoch)

    Okay I wait

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @eugyenoch,

    We have just released an update that lets users register new currencies. I recommend updating to the latest version and then adding the following blocks of code into a compatibility plugin:

    /**
     * Register "BTC" currency
     *
     * @param array $currencies
     *
     * @return array
     *
     */
    function slicewp_register_custom_currency_btc( $currencies ) {
    
    	$currencies['BTC'] = array(
    		'name' 					=> 'Bitcoin',
    		'symbol' 				=> '₿',
    		'symbol_position' 		=> 'before',
    		'decimal_places' 		=> 8,
    		'thousands_separator' 	=> ',',
    		'decimal_separator' 	=> '.'
    	);
    
    	return $currencies;
    
    }
    add_filter( 'slicewp_register_currency', 'slicewp_register_custom_currency_btc' );
    /**
     * Set the number of decimals to save currency amounts in the database
     *
     * @param int $decimals
     *
     * @return int
     *
     */
    function slicewp_sanitize_amount_decimals_to_8( $decimals ) {
    
    	return 8;
    	
    }
    add_filter( 'slicewp_sanitize_amount_decimals', 'slicewp_sanitize_amount_decimals_to_8' );

    Alternatively, if you don’t have a compatibility plugin for your website, I’ve prepared one for adding BTC to the currency list. You can download it here.

    Please try it out and let me know how it goes.

    All the best,
    Mihai

    • This reply was modified 4 years, 2 months ago by iova.mihai.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add custom currency’ is closed to new replies.