Callum
Callum

Reputation: 574

Woocommerce - Conditional for 'Featured?' Products

On a single product page I'd like to know if there's a conditional for detecting whether the current product has been marked as 'Featured'?

I've tried variations on:

if( has_term( 1, 'featured' ) ) { 
 etc ...

and

if( has_term( TRUE, 'featured' ) ) { 
 etc ...

No luck so far. Any ideas?

Upvotes: 0

Views: 104

Answers (1)

Callum
Callum

Reputation: 574

$current_product = wc_get_product( get_the_ID() );

$current_product_featured_query = $current_product->featured;

if( $current_product_featured_query == "yes" ) {...
*... this product is indeed, featured!*

does the job.

Upvotes: 1

Related Questions