Display the WooCommerce cart total in fiat and / or cryptocurrency

This snippet will display your cart total in either fiat + cryptocurrency (the default) or just crypto.

Just ETH to whatever crypto you want to show it in.

If you wish to display the total only in crypto, uncomment the first return line.

/**
	@brief		Display the cart total in the normal currency and / or crypto.
	@since		2018-11-07 15:18:24
**/
function mcc_woocommerce_cart_totals_order_total_html( $text )
{
	// Display the cart total in ETH
	$currency_id = 'ETH';
	
	// Is MCC installed?
	if ( ! function_exists( 'mycryptocheckout' ) )
		return $text;
	// Retrieve all of our currencies.
	$currencies = MyCryptoCheckout()->currencies();
	$currency = $currencies->get( $currency_id );
	// Is this currency known?
	if ( ! $currency )
		return $text;
	// We need the total without any symbols.
	$total = WC()->cart->get_total();
	// BTC is an html entity that needs to go.
	$total = html_entity_decode( $total );
	// Extract only numbers.
	$total = preg_replace( '/[^0-9\.\,]+/', '', $total );
	$new_price = $currency->convert( get_woocommerce_currency(), $total );
	$new_total = $new_price  . ' ' . $currency_id;
	
	// Uncomment this line to only display the total in crypto.
	//return $new_total;
	
	// This displays FIAT / CRYPTO
	return $text . ' / ' . $new_total;
}
add_filter( 'woocommerce_cart_totals_order_total_html', 'mcc_woocommerce_cart_totals_order_total_html', 100 );