WooCommerce featured products custom field
-
My understanding is that WooCommerce indicates featured products by maintaining a
_featured
meta_key with value “yes” or “no” for every single product. However, snippets like the following don’t seem to work:<?php $featured = trim(get_post_meta($post->ID, '_featured', true)); if ($featured == "yes") { ?> <span class="featured">Featured Product</span> <?php } ?>
I’ve searched quite a bit and can’t find any way to properly check inside the loop whether a product is featured for custom styling, etc.
Any insight? Cheers!
- The topic ‘WooCommerce featured products custom field’ is closed to new replies.