WooCommerce – Display price in Bitcoin

I am using WooCommerce for my online shop. I have my prices set in USD in the admin panel.

How can I display that price in Bitcoin for the front-end user?

Read More

I will make the script where it reads current Bitcoin value and convert that USD amount in BTC.

$backendPrice = 1000.00
$bitcoinPrice = 500.00
$displayPrice = 2

Related posts

Leave a Reply

2 comments

  1. This series of filter hooks will do the job:

    if( !is_admin() )
    {
        add_filter( 'woocommerce_get_sale_price', 'bit_price', 10, 2 );
        add_filter( 'woocommerce_get_regular_price', 'bit_price', 10, 2 );
        add_filter( 'woocommerce_get_price', 'bit_price', 10, 2 );
    
        add_filter( 'woocommerce_currency_symbol', function( $currency_symbol, $currency ) {
            return 'Bits'; //$currency_symbol;
        }, 10, 2 );
    
        add_filter( 'woocommerce_currency', function( $currency ) {
            return $currency;
        });
    }
    
    function bit_price( $price, $product )
    {
        return $price * 0.5;
    }