// define the woocommerce_product_is_on_sale callback
function custom_woocommerce_product_is_on_sale( $on_sale, $instance ){
//custom code here
return $on_sale
}
//add the action
add_filter('woocommerce_product_is_on_sale', 'custom_woocommerce_product_is_on_sale', 10, 2)