wc_gzd_is_revocation_exempt

The WooCommerce Germanized wc gzd is revocation exempt function.

Description

wc_gzd_is_revocation_exempt( $product, (string) $type = 'digital' ); 

Parameters (2)

0. $product
The product.
1. $type — Optional. (string) => 'digital'
The type.

Usage

  1. if ( !function_exists( 'wc_gzd_is_revocation_exempt' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-germanized/includes/wc-gzd-product-functions.php'; 
  3.  
  4. // The product. 
  5. $product = null; 
  6.  
  7. // The type. 
  8. $type = 'digital'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_gzd_is_revocation_exempt($product, $type); 
  12.  

Defined (1)

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

/includes/wc-gzd-product-functions.php  
  1. function wc_gzd_is_revocation_exempt( $product, $type = 'digital' ) { 
  2.  
  3. $types = apply_filters( 'woocommerce_gzd_digital_product_types', get_option( 'woocommerce_gzd_checkout_legal_digital_types', array( 'downloadable' ) ) ); 
  4.  
  5. if ( empty( $types ) ) 
  6. return false; 
  7.  
  8. else if ( ! is_array( $types ) ) 
  9. $types = array( $types ); 
  10.  
  11. if ( $type === 'digital' ) { 
  12. foreach ( $types as $revo_type ) { 
  13.  
  14. if ( wc_gzd_product_matches_extended_type( $revo_type, $product ) ) 
  15. return true; 
  16. } else if ( $type === 'service' ) { 
  17. if ( wc_gzd_get_gzd_product( $product )->is_service() ) 
  18. return true; 
  19.  
  20. if ( apply_filters( 'woocommerce_gzd_product_is_revocation_exception', false, $product, $type ) ) 
  21. return true; 
  22.  
  23. return false;