PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Product “New Badge” disappear after using WOOF Filter

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hey, I am using the Woof product filter, I added this snippet to show the new badge next to the product images:

// New badge for recent products
add_action( ‘woocommerce_before_shop_loop_item_title’, ‘new_badge’, 40 );

function new_badge() {
$product = wc_get_product( get_the_ID() );
$newness_days = 30; // Number of days the badge is shown
$created = strtotime( $product->get_date_created() );
if ( ( time() – ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
echo ” . esc_html__( ‘NEW’, ‘woocommerce’ ) . ”;
}
}

The badge is shown, but when I filter the shop, the badge disappears. Do I have to use a different visual hook of WOOF or change the code overall?

Hello

Please  drop  me  exact  link to the  issue