I would like to create a function that instead of hiding the products without thumbnails, would be ordered in such a way that the products with the highlighted image appear first on the shop page while those without the highlighted image appear at the end. I tried to modify an already existing function:
function woocommerce_product_query( $q ) {
$q->set( 'meta_key', '_thumbnail_id' );
$q->set('orderby', 'meta_value_num');
$q->set('order', 'DESC');
}
add_action( 'woocommerce_product_query', 'woocommerce_product_query' );
I tried adding orderby
to this already existing function too but nothing happens, keep hiding the products from me.
In this photo the function only hides the products without thumbnail.
I don’t know how to solve …