Adding Tokens

¬†Adding Ethereum tokens is a very straight forward process. Since the plugin uses CoinMarketCap is fetch exchange rates and logos, you need to ensure that your token is listed on their website. If it is not listed on CMC, see the ‘Adding Custom Tokens’ section at the bottom of the page which explains how to add a custom token to the plugin.

In this tutorial, we will add the OMG token.

Step 1

Head to the CoinMarketCap website and locate your token’s landing page. OMG’s is seen here and a screenshot seen below.




Step 2

Click the ‘Explorer’ link which takes you to the ‘Etherscan’ page that displays the tokens details (screenshot below).




Step 3

Copy the token’s code (OMG), decimals and contract address into the ‘Add Token’ form and click ‘Submit’

The token will then appear in the currencies list as seen below.



Adding Custom Tokens

If your Token is not listed on CoinMarketCap, you can still add it to the plugin using the same method described above however you will need to know the decimals and contract address.

Since the plugin generally uses CoinMarketCap to fetch the token’s logo and exchange rate, you will need to add a little code to your theme’s ‘functions.php’ file (or as a plugin) to provide this information.

The code example below assumes you are adding a token with code ‘MYTOKEN’. You will need to edit the code and change ‘MYTOKEN’ (2) with the code entered in the ‘Add Token’ form. You’ll also need to set the exchange rate (currently 100) and URL to your logo.

add_filter('affwp_crypto_exchange_rate', 'affwp_crypto_exchange_rate', 10, 3);
function affwp_crypto_exchange_rate($exchange_rate, $ticker, $base_currency) {
    if ( $ticker == 'MYTOKEN' ) :
            // Award 100 'MYTOKEN' for every 1 unit of base currency (100 for every dollar)
            $exchange_rate = 100;
    return $exchange_rate;

add_filter('affwp_crypto_currency_meta', 'affwp_crypto_currency_meta', 10, 3);
function affwp_crypto_currency_meta($meta, $currency_key, $ticker) {
    if ( $ticker == 'MYTOKEN' ) :
        // Add the link to a hosted version of your token's logo
        $meta[$currency_key]['logo'] = 'https://link_to_hosted_logo.png';
    return $meta;


Was this helpful to you?