This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: terms filter on custom page

#52467
gavriel_wtTjgavriel_wtTj
Participant

its a custom loop.
we are using jetengine query builder to create the query and then this is our code in the template:

if (!empty($product_ids)) {
// Convert the comma-separated product IDs into an array
$product_ids_array = explode(‘, ‘, $product_ids);

// Query the products based on the retrieved IDs
$args = array(
‘post_type’ => ‘product’, // Ensure you’re querying WooCommerce products
‘post__in’ => $product_ids_array,
‘orderby’ => ‘post__in’, // Preserve the order from the JetEngine query
‘posts_per_page’ => -1, // Adjust the number of products as needed
);

$product_query = new WP_Query($args);

if ($product_query->have_posts()) :
?>
<ul id=”products-grid” class=”products-grid” style=”–width: 45%;”>
<?php while ($product_query->have_posts()) : $product_query->the_post(); ?>

<!– Include the product-card loop template from the loops folder –>
<?php get_template_part(‘template-parts/product-loop’, ‘loop’); ?>

<?php endwhile; ?>

<?php wp_reset_postdata();
else :
echo ‘No products found for the selected query.’;
endif;