Answer the question
In order to leave comments, you need to log in
How to know if a product is recommended (Wordpress + Woocommerce)?
The only option that came to my mind is to get a list of recommended ones, as shown in the code below. Then, when displaying each new product, check whether it is included in the received coveted array and, accordingly, mark it. Are there better ways?
$args = array(
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
),
),
);
$featured_goods = new WP_Query( $args );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question