Код: Выделить всё
function show_new_badge() {
global $product;
$newness_days = 30; // Set days as new
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo '' . esc_html__( 'New', 'woocommerce' ) . '';
}
}
add_action( 'woocommerce_before_shop_loop_item', 'show_new_badge', 1 );
Подробнее здесь: https://stackoverflow.com/questions/785 ... oocommerce
Мобильная версия