In WooCommerce, I'm trying to get "recent products" that are no featured with this shortcode:
[product_attribute attribute='_featured' filter='no' orderby="date" order="desc"]
But it doesn't seem to take any effect.
How can I achieve this?
Please do not propose 3rd party plugins.*
Thanks
*More info in official Shortcodes included with WooCommerce docs.
In this shortcode, attributes works with variable products and your actual shortcode can't really work as featured product functionality is not an attribute.
You should better try to use [recent_products]
shortcodes instead, setting in all your featured products a "Featured" category (with "featured" slug)…
Then you could use the shortcode this way:
[recent_products category='featured' operator='NOT IN']
You don't need to set orderby
and order
arguments as the defaults ones are:
$atts = shortcode_atts( array(
'per_page' => '12',
'columns' => '4',
'orderby' => 'date',
'order' => 'desc',
'category' => '', // Slugs
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
), $atts, 'recent_products' );
See related documentation: WC_Class Shortcodes - Recent Products shortcode source code