yit_get_display_price

The YITH WooCommerce Compare yit get display price function.

Description

yit_get_display_price( (WC_Product) $product, (string) $price = '', (int) $qty = 1 ); 

Parameters (3)

0. $product (WC_Product)
The product.
1. $price — Optional. (string) => ''
The price.
2. $qty — Optional. (int) => 1
The qty.

Usage

  1. if ( !function_exists( 'yit_get_display_price' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-compare/plugin-fw/yit-woocommerce-compatibility.php'; 
  3.  
  4. // The product. 
  5. $product = null; 
  6.  
  7. // The price. 
  8. $price = ''; 
  9.  
  10. // The qty. 
  11. $qty = 1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = yit_get_display_price($product, $price, $qty); 
  15.  

Defined (1)

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

/plugin-fw/yit-woocommerce-compatibility.php  
  1. function yit_get_display_price( $product, $price = '', $qty = 1 ) { 
  2.  
  3. if ( version_compare( WC()->version, '2.7.0', '>=' ) ) { 
  4.  
  5. $price = wc_get_price_to_display( $product, array( 'qty' => $qty, 'price' => $price ) ); 
  6. } else { 
  7.  
  8. $price = $product->get_display_price( $price, $qty ); 
  9.  
  10. return $price;