formatted_woocommerce_price
Filter formatted price.
Использование
add_filter( 'formatted_woocommerce_price', 'wp_kama_formatted_woocommerce_price_filter', 10, 6 );
/**
* Function for `formatted_woocommerce_price` filter-hook.
*
* @param float $formatted_price Formatted price.
* @param float $price Unformatted price.
* @param int $decimals Number of decimals.
* @param string $decimal_separator Decimal separator.
* @param string $thousand_separator Thousand separator.
* @param float|string $original_price Original price as float, or empty string. Since 5.0.0.
*
* @return float
*/
function wp_kama_formatted_woocommerce_price_filter( $formatted_price, $price, $decimals, $decimal_separator, $thousand_separator, $original_price ){
// filter...
return $formatted_price;
}
- $formatted_price(float)
- Formatted price.
- $price(float)
- Unformatted price.
- $decimals(int)
- Number of decimals.
- $decimal_separator(строка)
- Decimal separator.
- $thousand_separator(строка)
- Thousand separator.
- $original_price(float|строка)
- Original price as float, or empty string. Since 5.0.0.
Где вызывается хук
woocommerce/includes/wc-formatting-functions.php 635
$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'], $original_price );