登录后可变产品价格为0-Woocommerce

时间:2018-09-17 07:08:49

标签: wordpress woocommerce

我是新的wordpress cms框架并自定义产品页面。我有一个问题,客户登录的可变产品价格显示为0.00。如何解决此问题。

Attached Image

我的代码:

$unformatted_price = $price;
$negative          = $price < 0;
$price             = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * -1 : $price ) );
$price             = apply_filters( 'formatted_woocommerce_price', number_format( $price, $args['decimals'], $args['decimal_separator'], $args['thousand_separator'] ), $price, $args['decimals'], $args['decimal_separator'], $args['thousand_separator'] );

if ( apply_filters( 'woocommerce_price_trim_zeros', false ) && $args['decimals'] > 0 ) {
    $price = wc_trim_zeros( $price );
}

$formatted_price = ( $negative ? '-' : '' ) . sprintf( $args['price_format'], '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol( $args['currency'] ) . '</span>', $price );

$return          = '<span class="woocommerce-Price-amount amount">' . get_woocommerce_currency_symbol( $args['currency'] )  . $price . '</span>';

if ( $args['ex_tax_label'] && wc_tax_enabled() ) {
    $return .= ' <small class="woocommerce-Price-taxLabel tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
}

0 个答案:

没有答案