WordPress at Your Fingertips
function is not described

WC_Product_Variable::is_on_sale() public WC 1.0

Returns whether or not the product is on sale.

{} It's a method of the class: WC_Product_Variable{}

Hooks from the method
Return

true|false.

Usage

$WC_Product_Variable = new WC_Product_Variable();
$WC_Product_Variable->is_on_sale( $context );
$context(string)
What the value is for. Valid values are view and edit. What the value is for. Valid values are view and edit.
Default: 'view'

Code of WC_Product_Variable::is_on_sale() WC 5.7.0

public function is_on_sale( $context = 'view' ) {
	$prices  = $this->get_variation_prices();
	$on_sale = $prices['regular_price'] !== $prices['sale_price'] && $prices['sale_price'] === $prices['price'];

	return 'view' === $context ? apply_filters( 'woocommerce_product_is_on_sale', $on_sale, $this ) : $on_sale;
}