Hi there!
The WooCommerce-function wc_price() returns the formatted price given by an argument with some Markup arround it. Would be nice to have a Return-Filter to remove this Markup,
Source:
https://github.com/woothemes/woocommerce/blob/master/includes/wc-formatting-functions.php#L303#L328
Possible Fix
extract()$return for Return-Filter/**
* Format the price with a currency symbol.
*
* @access public
* @param float $price
* @param array $args (default: array())
* @return string
*/
function wc_price( $price, $args = array() ) {
$args = shortcode_atts(
array(
'ex_tax_label' => '0'
),
$args
);
$return = '';
$num_decimals = absint( get_option( 'woocommerce_price_num_decimals' ) );
$currency = isset( $args['currency'] ) ? $args['currency'] : '';
$currency_symbol = get_woocommerce_currency_symbol($currency);
$decimal_sep = wp_specialchars_decode( stripslashes( get_option( 'woocommerce_price_decimal_sep' ) ), ENT_QUOTES );
$thousands_sep = wp_specialchars_decode( stripslashes( get_option( 'woocommerce_price_thousand_sep' ) ), ENT_QUOTES );
$price = apply_filters( 'raw_woocommerce_price', floatval( $price ) );
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $num_decimals, $decimal_sep, $thousands_sep ), $price, $num_decimals, $decimal_sep, $thousands_sep );
if ( apply_filters( 'woocommerce_price_trim_zeros', false ) && $num_decimals > 0 ) {
$price = wc_trim_zeros( $price );
}
$formatted_price = sprintf( get_woocommerce_price_format(), $currency_symbol, $price );
$return = '<span class="amount">' . $formatted_price . '</span>';
if ( $args[ 'ex_tax_label' ] && get_option( 'woocommerce_calc_taxes' ) == 'yes' ) {
$return .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
}
return apply_filters( 'wc_price', $return, $price, $args );
}
strip_tags function from php, delete html tags:
strip_tags(wc_price($product->price))
Most helpful comment
strip_tags function from php, delete html tags:
strip_tags(wc_price($product->price))