woocommerce_gzd_template_variation_sale_price_label

The WooCommerce Germanized woocommerce gzd template variation sale price label function.

Description

woocommerce_gzd_template_variation_sale_price_label( $price, $product ); 

Parameters (2)

0. $price
The price.
1. $product
The product.

Usage

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

Defined (1)

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

/includes/wc-gzd-template-functions.php  
  1. function woocommerce_gzd_template_variation_sale_price_label( $price, $product ) { 
  2.  
  3. if ( ! is_product() && get_option( 'woocommerce_gzd_display_listings_sale_price_labels' ) === 'no' ) 
  4. return $price; 
  5. else if ( is_product() && get_option( 'woocommerce_gzd_display_product_detail_sale_price_labels' ) === 'no' ) 
  6. return $price; 
  7.  
  8. $display_regular_price = $product->get_display_price( $product->get_regular_price() ); 
  9. $display_sale_price = $product->get_display_price( $product->get_sale_price() ); 
  10.  
  11. return wc_gzd_get_gzd_product( $product )->get_price_html_from_to( $display_regular_price, $display_sale_price );