Home Forums WoodMart support forum Data source Product with NEW label not displayed Reply To: Data source Product with NEW label not displayed

#292121

Artem Temos
Keymaster

Try to edit the file woodmart/inc/integrations/elementor/elements/products/products.php and replace the following part

if ( 'new' === $settings['post_type'] ) {
	$query_args['meta_query'][] = array(
		'relation' => 'OR',
		array(
			'key'     => '_woodmart_new_label',
			'value'   => 'on',
			'compare' => 'IN',
		),
		array(
			'key'     => '_woodmart_new_label_date',
			'value'   => date( 'Y-m-d' ), // phpcs:ignore
			'compare' => '>',
			'type'    => 'DATE',
		),
	);
}

with this one

if ( 'new' === $settings['post_type'] ) {
	$days = woodmart_get_opt( 'new_label_days_after_create' );
	if ( $days ) {
		$query_args['date_query'] = array(
			'after' => date( 'Y-m-d', strtotime( '-' . $days . ' days' ) ),
		);
	} else {
		$query_args['meta_query'][] = array(
			'relation' => 'OR',
			array(
				'key'     => '_woodmart_new_label',
				'value'   => 'on',
				'compare' => 'IN',
			),
			array(
				'key'     => '_woodmart_new_label_date',
				'value'   => date( 'Y-m-d' ), // phpcs:ignore
				'compare' => '>',
				'type'    => 'DATE',
			),
		);
	}
}