开发者

How can I show product parent category in woocommerce?

开发者 https://www.devze.com 2022-12-07 21:34 出处:网络
I\'m trying to show product parent categories (Just one category not all). Now how can I show the product parent category in woocommerce?

I'm trying to show product parent categories (Just one category not all). Now how can I show the product parent category in woocommerce?

$woocpt_args = [
        'post_type'      => 'product',
 开发者_如何学编程   ];
    $woocpt_all_products = new WP_Query( $woocpt_args );
    while ( $woocpt_all_products->have_posts() ) : $woocpt_all_products->the_post();
        global $product;
        echo wc_get_product_category_list(get_the_id());
    endwhile;


Can you please be more detailed about this? What do you need to do and you looking for this? I'm asking because I think it's a wrong way to "call" a parent category with your way.

Remember, screenshots and urls always helps a lot the progress of your help you can receive

Friendly, George

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号