woocommerce_sale_flash

The WooCommerce woocommerce sale flash hook.

Description

apply_filters( 'woocommerce_sale_flash', (string) $span_class_onsale_esc_html_sale_woocommerce_span, (unknown) $post, (unknown) $product ); 

Parameters (3)

0. $span_class_onsale_esc_html_sale_woocommerce_span — Optional. (string) => '' . esc_html__( 'Sale!', 'woocommerce' ) . ''
The span class onsale esc html sale woocommerce span.
1. $post (unknown)
The post.
2. $product (unknown)
The product.

Usage

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

Defined (2)

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

/templates/single-product/sale-flash.php  
  1. <?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product ); ?> 
/templates/loop/sale-flash.php  
  1. <?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product ); ?>