woocommerce中的多种货币未显示

时间:2020-02-04 18:18:40

标签: wordpress woocommerce plugins

我是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 );

0 个答案:

没有答案