I am using the following code in my Wordpress website to get data on Woocommerce products:
$args = array( 'post_type' => 'product', 'posts_per_page' => 100, 'product_cat' => 'Tools' );
$loop = new WP_Query( $args );
echo $loop->get_posts();
wp_reset_query();
This only gets data on the posts. How do I get other product data such as price. I would usually get this using get_post_meta()
.
How do I get the post meta data without using a loop? Or is there one way to get all the data through one function or method?