Example Woocommerce Flexslider Slider Loop with Categories

Example of a Loop within a loop using Woocommerce categories and it’s related products. Loops through the categories, shows the product category image, then shows three products related to that category. As an added bonus, there is also a query to only pull the products with the Advanced Custom Field of, “yes” when referring to “Show on Homepage Slider?” (feature_on_homepage_slider)

This example is just the flexslider loop. It does not show how to implement the flexslider.

$number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids, 'parent' => 0 ); $product_categories = get_terms( 'product_cat', $args ); ?>
  • term_id, 'thumbnail_id', true ); // get the image URL $image = wp_get_attachment_url( $thumbnail_id ); ?> slug; $args = array( 'post_type' => 'product', 'posts_per_page' => 3, 'product_cat' => $productCat, // which product category to pull // we can also query only those chosen with an Advanced Custom Field of "Yes" 'meta_query' => array( array( 'key' => 'feature_on_homepage_slider', // Custom field radio button 'value' => 'yes', // default set to no, so they have to check yes. 'compare' => '=', 'type' => 'CHAR' ) ) ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) : ?>
    have_posts() ) : $loop->the_post(); ?>
    $