WooCommerce – Get featured products IDs
Posted on This might be outdated!
And another great snippet that i coded today. It’s a function that creates an array of featured products IDs. That’s pretty useful if for example you want to quickly get only featured products IDs, or doing a condition (if has featured product then do that…). The function store all featured products IDs within a transient to avoid unwanted connections to the database. Simply place that code within your functions.php file: