yit_get_price_excluding_tax

The YITH WooCommerce Compare yit get price excluding tax function.

Description

(float|string) yit_get_price_excluding_tax( (WC_Product) $product, (int) $qty = 1, (string) $price = '' ); 

Returns (float|string)

Parameters (3)

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

Usage

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

Defined (1)

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

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