woocommerce_variation_prices_sale_price filter-hookWC 3.0.0

Filters the sale price for a product variation before it is used in price calculations and caching.

IMPORTANT: see the documentation for the woocommerce_variation_prices_price

Usage

add_filter( 'woocommerce_variation_prices_sale_price', 'wp_kama_woocommerce_variation_prices_sale_price_filter', 10, 3 );

/**
 * Function for `woocommerce_variation_prices_sale_price` filter-hook.
 * 
 * @param string|float $sale_price The variation's sale price.
 * @param WC_Product   $variation  The variation product object.
 * @param WC_Product   $product    The parent variable product object.
 *
 * @return string|float
 */
function wp_kama_woocommerce_variation_prices_sale_price_filter( $sale_price, $variation, $product ){

	// filter...
	return $sale_price;
}
$sale_price(string|float)
The variation's sale price.
$variation(WC_Product)
The variation product object.
$product(WC_Product)
The parent variable product object.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

WC_Product_Variable_Data_Store_CPT::read_price_data()
woocommerce_variation_prices_sale_price
woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php 414
$sale_price = apply_filters( 'woocommerce_variation_prices_sale_price', $variation->get_sale_price( 'edit' ), $variation, $product );

Where the hook is used in WooCommerce

Usage not found.