我是Wordpress插件开发的新手。我遇到了一些问题。显示一种货币付款,因此将显示多种货币付款。 下面的代码显示了一种货币。
// Show product prices in fiat + crypto
function mcc_woocommerce_get_price_html( $text, $product )
{
// Is MCC installed?
if ( ! function_exists( 'mycryptocheckout' ) )
return $text;
// Retrieve all of our currencies.
$currencies = MyCryptoCheckout()->currencies();
// Change this to your preferred currency symbol
$show_currency = 'BCH';
$currency = $currencies->get( $show_currency );
// Is this currency known?
if ( ! $currency )
return $text;
$new_price = $currency->convert( get_woocommerce_currency(), $product->get_price() );
return $text . ' / ' . $new_price . ' ' . $show_currency;
}
add_filter( 'woocommerce_get_price_html', 'mcc_woocommerce_get_price_html', 100, 2 );