wc_format_price_range

Format a price range for display.

Description

(string) wc_format_price_range( (string) $from, (string) $to ); 

Returns (string)

Parameters (2)

0. $from (string)
The from.
1. $to (string)
The to.

Usage

  1. if ( !function_exists( 'wc_format_price_range' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4. // The from. 
  5. $from = ''; 
  6.  
  7. // The to. 
  8. $to = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_format_price_range($from, $to); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-formatting-functions.php  
  1. function wc_format_price_range( $from, $to ) { 
  2. $price = sprintf( _x( '%1$s – %2$s', 'Price range: from-to', woocommerce ), is_numeric( $from ) ? wc_price( $from ) : $from, is_numeric( $to ) ? wc_price( $to ) : $to ); 
  3. return apply_filters( 'woocommerce_format_price_range', $price, $from, $to );