I\'m trying to show Single Product Data in Custom Page by given Category ID but when I used the below code:
<?php
$args = array( \'post_type\' => \'product\', \'product_cat\' => \'category-id\' );
if ( ! defined( \'ABSPATH\' ) ) {
exit; // Exit if accessed directly
}
get_template_part( \'woocommerce/archive-product\', \'page\' );
?>
It only fetch data like this when I insert print_r(query_posts( $args ))
then I got
Array
(
[0] => WP_Post Object
(
[ID] => 391
[post_author] => 1
[post_date] => 2018-08-03 08:55:15
[post_date_gmt] => 2018-08-03 08:55:15
[post_content] =>
[post_title] => 4 Bars
[post_excerpt] =>
[post_status] => publish
[comment_status] => open
[ping_status] => closed
[post_password] =>
[post_name] => 4-bars
[to_ping] =>
[pinged] =>
[post_modified] => 2018-08-03 09:09:22
[post_modified_gmt] => 2018-08-03 09:09:22
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://localhost/abc/?post_type=product&p=391
[menu_order] => 0
[post_type] => product
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
)
so, If you consider that [guid] => link
, which will re-direct me in single-product.php page, so, I want the all single product data shown according to category ID in Custom Page; I\'m not getting a clue that How could I do?
Let me know, if you people have any solution?