yit_get_refund_amount

The YITH WooCommerce Wishlist yit get refund amount function.

Description

(float) yit_get_refund_amount( $refund, (string) $context = 'view' ); 

Returns (float)

Parameters (2)

0. $refund
\WC_Order_Refund
1. $context — Optional. (string) => 'view'
The context.

Usage

  1. if ( !function_exists( 'yit_get_refund_amount' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-wishlist/plugin-fw/yit-woocommerce-compatibility.php'; 
  3.  
  4. // \WC_Order_Refund 
  5. $refund = null; 
  6.  
  7. // The context. 
  8. $context = 'view'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = yit_get_refund_amount($refund, $context); 
  12.  

Defined (1)

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

/plugin-fw/yit-woocommerce-compatibility.php  
  1. function yit_get_refund_amount( $refund, $context = 'view' ) { 
  2. $is_wc_data = $refund instanceof WC_Data; 
  3.  
  4. if ( $is_wc_data ) { 
  5. return $refund->get_amount( $context ); 
  6. } else { 
  7. return $refund->get_refund_amount();