Saturday, April 20, 2024
Bootstrap 4WoocommerceWordpress Tricks

WordPress Query – Show Woocommerce Products in Frontend

How to add custom meta title and meta description in Wordpress?

Wordpress Query - Show Woocommerce Products in Frontend

Hello to all, welcome to In this post, I will tell you, WordPress Query – Show Woocommerce Products in Frontend.

I am using Bootstrap 4 table for show Woocommerce products data.

With the help of WordPress wp_query, I am getting the Woocommerce Products data. I am showing limited data but we can get products data with our requirement.


Here is the working image:


Wordpress Query - Show Woocommerce Products in Frontend


Here is the working and tested code and you can add this into your any theme’s template file:

<link rel="stylesheet" href="">
  <script src=""></script>
  <script src=""></script>
  <script src=""></script>
  <div class="container">
  <table class="table table-hover">
    <thead class="thead-dark">
        <th>Product Name</th>
        <th>Product Price</th>
        <th>Product Type</th>
        <th>Added By</th>
    $args = array(
        'post_type' => 'product',
        'posts_per_page' => -1
    $loop = new WP_Query( $args );
    if ( $loop->have_posts() ): while ( $loop->have_posts() ): $loop->the_post();
        global $product
        <td><?php echo '<a href="'. get_permalink() .'"><img style="width:40px;height:40px;margin-right:5px;" class="img-responsive" src="' . get_the_post_thumbnail_url() . '">'.get_the_title().'</a>'; ?></td>
        <td><?php echo get_post_meta( get_the_ID(), '_price', true ); ?></td>
        <td><?php echo $product->product_type; ?></td>
        <td><?php echo get_post_meta( get_the_ID(), '_stock_status', true ); ?></td>
        <td><?php $author_id = get_post_field ('post_author', $cause_id);
    $display_name = get_the_author_meta( 'display_name' , $author_id ); 
    echo $display_name; ?></td>

    endwhile; endif; wp_reset_postdata();


Hope this helps, if you have any query related to this post, then do comment below or you can ask question.

Thank you,

Happy Coding,



the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.