woocommerce_gzd_product_is_on_unit_sale

Checks whether unit price is on sale.

Description

apply_filters( 'woocommerce_gzd_product_is_on_unit_sale', (unknown) $is_on_sale, (unknown) $instance ); 

Parameters (2)

0. $is_on_sale (unknown)
The is on sale.
1. $instance (unknown)
The instance.

Usage

To run the hook, copy the example below.
  1. $is_on_sale = apply_filters( 'woocommerce_gzd_product_is_on_unit_sale', $is_on_sale, $instance ); 
  2.  
  3. if ( !empty( $is_on_sale ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_gzd_product_is_on_unit_sale callback 
  2. function filter_woocommerce_gzd_product_is_on_unit_sale( $is_on_sale, $instance ) { 
  3. // make filter magic happen here... 
  4. return $is_on_sale
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_gzd_product_is_on_unit_sale', 'filter_woocommerce_gzd_product_is_on_unit_sale', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_gzd_product_is_on_unit_sale', 'filter_woocommerce_gzd_product_is_on_unit_sale', 10, 2 ); 

Defined (2)

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

/includes/class-wc-gzd-product-variable.php  
  1. return apply_filters( 'woocommerce_gzd_product_is_on_unit_sale', $is_on_sale, $this ); 
/includes/abstracts/abstract-wc-gzd-product.php  
  1. return apply_filters( 'woocommerce_gzd_product_is_on_unit_sale', ( $this->get_unit_sale_price() !== $this->get_unit_regular_price() && $this->get_unit_sale_price() == $this->get_unit_price() ), $this );