loop - Woocommerce featured products query no longer working

I have a query that's stopped working since Woo 3.6 upgrade I think. I'm trying to get products in a category

I have a query that's stopped working since Woo 3.6 upgrade I think. I'm trying to get products in a category that are featured. Any help would be much appreciated:)

<?php

                            $args = array(
                                        'post_type'         => 'product',
                                        'post_status'       => 'publish',
                                        'posts_per_page'    => 4,
                                        'orderby'           => 'date',
                                        'order'             => 'DESC',
                                        'post__in'          => wc_get_featured_product_ids(),
                                        'tax_query'         => array(
                                            array(
                                                'taxonomy'  => 'product_cat',
                                                'field'     => 'ID',
                                                'terms'     => intval( $cat_id )
                                            )
                                        )
                                    );

                            $query = new WP_Query( $args ); 
                        ?>

Unfortunately this code no longer works and returns nothing. But if I comment out the 'post__in' line it works but returns the latest products in that category and not the featured. Hope that makes sense.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745472829a4629212.html

相关推荐

  • loop - Woocommerce featured products query no longer working

    I have a query that's stopped working since Woo 3.6 upgrade I think. I'm trying to get products in a category

    3小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信