Merge pull request #16678 from Drivingralle/patch-3
Pass unformated price into filter to allow better overwrite
This commit is contained in:
commit
42e19f1bb8
|
@ -489,6 +489,7 @@ function wc_price( $price, $args = array() ) {
|
||||||
'price_format' => get_woocommerce_price_format(),
|
'price_format' => get_woocommerce_price_format(),
|
||||||
) ) ) );
|
) ) ) );
|
||||||
|
|
||||||
|
$unformatted_price = $price;
|
||||||
$negative = $price < 0;
|
$negative = $price < 0;
|
||||||
$price = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * -1 : $price ) );
|
$price = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * -1 : $price ) );
|
||||||
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $decimals, $decimal_separator, $thousand_separator ), $price, $decimals, $decimal_separator, $thousand_separator );
|
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $decimals, $decimal_separator, $thousand_separator ), $price, $decimals, $decimal_separator, $thousand_separator );
|
||||||
|
@ -504,7 +505,14 @@ function wc_price( $price, $args = array() ) {
|
||||||
$return .= ' <small class="woocommerce-Price-taxLabel tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$return .= ' <small class="woocommerce-Price-taxLabel tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'wc_price', $return, $price, $args );
|
/**
|
||||||
|
* Filters the string of price markup.
|
||||||
|
*
|
||||||
|
* @param string $return Price HTML markup
|
||||||
|
* @param float $unformatted_price Price as float to allow plugins custom formatting
|
||||||
|
* @param array $args Pass on the args
|
||||||
|
*/
|
||||||
|
return apply_filters( 'wc_price', $return, $unformatted_price, $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue