How to display woocommerce product base on it's Id.
Hi,I have small issue in displaying woocommerce single product base on it's id. i want to show specific products by using it's id. is there any way so i can use it to fetch specific product?
Here is my code.
$my_query = new WP_Query(array( 'post_type' => "product", 'product_id' => 4977 ));
if ( $my_query->have_posts() ):
while ( $my_query->have_posts() ):
$my_query->the_post();
global $product;
the_title();
endwhile; endif;
wp_reset_query();
Please let me know if i did something wrong.
Thank you
Oct 28, 2017
Wordpress Bugs