I am trying to list my products using
I have used a query such as the following one:
$slider_products_q = new WP_Query([ 'posts_per_page' => 8, 'post__in' => $slides_product_ids, 'post_type' => 'product', 'orderby' => 'date', 'order' => 'DESC' ]);
It works perfectly, however when I want to access WooCommerce methods inside the loop such as
get_html_price it becomes a bit tricky.
I have managed to handled it using this way, yet the performace is not good and the query takes about '0.7' seconds to load up.
This is how I loop though each item:
if ($slider_products_q->have_posts()): while($slider_products_q->have_posts()): $slider_products_q->the_post(); $product_id = get_the_ID(); global $product; ...
Then I could call
I also did try to query products using Woocommerce methods but since they load up a lot of custom attributes the query takes even much more time.
Any suggestion of how to improve this?
By the way I only care about using Woocommerce methods such as
Attributes or custom terms are not necessary at all.