admin管理员组文章数量:1414614
I wanted to get some advice on how to list all my inventory attributes values. I have this simple code that will output the products as plain text, But instead of the_title();
I want a list of all products by their attribute's values. So, if a product has attribute carat it will be listed as follows:
carat
0.32
0.41
2.3
3.3
A product has attribute color and another product has attribute carat and they will be listed as
red
0.32
blue
0.32
0.41
2.3
3.3
Basically, I want to know how to do it for multiple attributes to get their values, cuz bottom line the title of my products are the same values concatenated together.
Right now, I am only getting a list of titles, but I want a list of attributes' values.
<?php
$params = array('posts_per_page' => 5, 'post_type' => 'product');
$wc_query = new WP_Query($params);
?>
<?php if ($wc_query->have_posts()) : ?>
<?php while ($wc_query->have_posts()) : $wc_query->the_post(); ?>
<?php the_title();?><br>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<p><?php _e( 'No Products' ); ?></p>
<?php endif; ?>
Thanks all for viewing this.
本文标签: woocommerce offtopicHow to list all WC products by their attributes values
版权声明:本文标题:woocommerce offtopic - How to list all WC products by their attributes values? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745191592a2646935.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论