The question is about the variable product! For a simple product, it becomes the following code:
add_action( 'woocommerce_before_shop_loop_item_title', function() { global $product; $akc = get_post_meta(get_the_ID(), '_sale_price', true); if ( $akc > 0 ) { echo '<span class="onsale soldout">Акция!</span>'; } }); But it is not clear how to get the value of all the fields with the sale price (sale_price) for variations? Tried to take from $ prices_array , but in vain.
UPDATE
Get the price in this way also did not work:
if ( 'product_variation' === $_this->post_type ) { $data = (object) $_this->get_data(); $variation_price = $data->price; $product_id = $data->parent_id; $variation_sale_price = get_sale_price( $variation_price, $product_id ); var_dump($variation_sale_price);