I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Price of one coin not correct

dashed-slug.net Forums General discussion Price of one coin not correct

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5734
    megeanwasson
    Participant

    Hi Alex,
    Keep up the great work, I think we are starting to get close to fixing most bugs 🙂

    I have 1 coin which is not getting the correct price and am not sure why.
    All the other coins are getting the correct price which can then be used inside the woocommerce plugin on products.
    Just this one coin is behaving oddly.
    On the coingecko ticker widget the correct price shows, on coingecko site the correct prices show in both USD and BTC

    I have tried with transients enabled and disabled makes not difference.

    Exchange rate providers enabled and using wallets woocommerce plugin:
    Fixer with api key activated
    Coingecko

    rapids-incorrect-price-1

    rapids-incorrect-price-2

    rapids-incorrect-price-3

    rapids-incorrect-price-4

    rapids-incorrect-price-5

    rapids-incorrect-price-6

    Any info will be great to get this resolved or steps to try and pinpoint where this is going wrong.

    Regards
    Megan

    #5735
    megeanwasson
    Participant

    Forgot last image
    rapids-incorrect-price-7

    #5736
    alexg
    Keymaster

    Hello Megan,

    Thank you as always for the detailed screenshots.

    My first thought would be that there is maybe a fiat currency from fixer, with the same symbol, overwriting the value. This is not the case.

    Which Exchange rate providers are you using? Do you have only CoinGecko enabled?

    I will investigate and let you know.

    It shouldn’t be necessary, but if you want to force a reload of all exchange rates, it is very easy if you are using wp-cli:

    wp option delete wallets_rates
    wp transient delete wallets_rates_last_run

    I will investigate on my end and let you know shortly what I found.

    with regards

    #5737
    alexg
    Keymaster

    Ignore my last question, you already mentioned which providers you are using.

    #5740
    megeanwasson
    Participant

    I already tried forcing rates update after deleting on cli, made no diffs.
    When it pulled in the rates those wrong ones were there again.

    #5741
    alexg
    Keymaster

    I have made a bad assumption, that coin symbols are unique, when in fact they are not.

    The price you see is not that of RapidCoin (RPD) but that of Ripped (RPD).

    Let me think about how to approach this…

    #5742
    alexg
    Keymaster

    Hello again,

    I have a solution:

    
    function wallets_rates_rapidcoin( $rates ) {
    	$data = json_decode( file_get_contents( 'https://api.coingecko.com/api/v3/simple/price?ids=rapids&vs_currencies=USD,BTC' ) );
    
    	if ( $data ) {
    		$rates['USD_RPD'] = $data->rapids->usd;
    		$rates['BTC_RPD'] = $data->rapids->btc;
    	}
    	return $rates;
    }
    
    add_filter( 'wallets_rates', 'wallets_rates_rapidcoin', 100 );
    

    You can insert this into your theme or as a separate one-file plugin.

    Or, if you are using a file similar to this one, you can add the code at the bottom of the file.

    with regards

    #5743
    megeanwasson
    Participant

    Hi Alex,
    Great that does over-ride the price, now correct prices showing in exhange-rate and woocommerce product.

    You are a genius ::

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.