get_woocommerce_price_format

Get the price format depending on the currency position.

Description

(string) get_woocommerce_price_format(); 

Returns (string)


Usage

  1. if ( !function_exists( 'get_woocommerce_price_format' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_woocommerce_price_format(); 
  7.  

Defined (1)

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

/includes/wc-formatting-functions.php  
  1. function get_woocommerce_price_format() { 
  2. $currency_pos = get_option( 'woocommerce_currency_pos' ); 
  3. $format = '%1$s%2$s'; 
  4.  
  5. switch ( $currency_pos ) { 
  6. case 'left' : 
  7. $format = '%1$s%2$s'; 
  8. break; 
  9. case 'right' : 
  10. $format = '%2$s%1$s'; 
  11. break; 
  12. case 'left_space' : 
  13. $format = '%1$s %2$s'; 
  14. break; 
  15. case 'right_space' : 
  16. $format = '%2$s %1$s'; 
  17. break; 
  18.  
  19. return apply_filters( 'woocommerce_price_format', $format, $currency_pos );