‘product’, ‘posts_per_page’ => -1, ‘product_cat’ => ‘your-category-slug’, ); $products = new WP_Query($args); if ($products->have_posts()) { while ($products->have_posts()) { $products->the_post(); wc_get_template_part(‘content’, ‘product’); } } else { echo ‘No products found in this category.’; } wp_reset_postdata(); ?>
<div class=”single-product-content”> <?php $product = wc_get_product(get_page_by_path(‘your-product-slug’, OBJECT, ‘product’)); if ($product) { wc_get_template_part(‘content’, ‘single-product’); } else { echo ‘Product not found.’; } ?> </div>