<?php 
  $expert_makeup_stylist_aboutus = get_theme_mod('expert_makeup_stylist_our_products_show_hide_section', 0);
  
  if ($expert_makeup_stylist_aboutus == '1') {
?>
<section id="product-section" class="my-5 mx-md-0 mx-3">
  <div class="container">
    <div class="row">
        <div class="col-lg-6 col-md-6 wow fadeInRight" data-wow-delay="0.5s">
            <?php
              $expert_makeup_stylist_our_products_heading_section = get_theme_mod('expert_makeup_stylist_our_products_heading_section');
              $expert_makeup_stylist_our_products_content_section = get_theme_mod('expert_makeup_stylist_our_products_content_section');
              $expert_makeup_stylist_detail_content = get_theme_mod('expert_makeup_stylist_detail_content');
            ?>
            <?php if ($expert_makeup_stylist_our_products_heading_section != '') { ?>
              <h2 class="mb-4"><?php echo esc_html(apply_filters('expert_makeup_stylist_topheader', $expert_makeup_stylist_our_products_heading_section)); ?></h2>
            <?php } ?>
            <?php if ($expert_makeup_stylist_our_products_content_section != '') { ?>
              <p class="main-content mb-4"><?php echo esc_html(apply_filters('expert_makeup_stylist_topheader', $expert_makeup_stylist_our_products_content_section)); ?></p>
            <?php } ?>
            <?php if ($expert_makeup_stylist_detail_content != '') { ?>
              <p class="main-details my-2"><?php echo esc_html(apply_filters('expert_makeup_stylist_topheader', $expert_makeup_stylist_detail_content)); ?></p>
            <?php } ?>
            <div class="offer-box-btn mt-4 mb-4">
              <?php
                $expert_makeup_stylist_our_products_btn_link_section = get_theme_mod('expert_makeup_stylist_our_products_btn_link_section');
                $expert_makeup_stylist_our_products_btn_section = get_theme_mod('expert_makeup_stylist_our_products_btn_section');
                if ($expert_makeup_stylist_our_products_btn_link_section != '' || $expert_makeup_stylist_our_products_btn_section != '') { ?>
                <a href="<?php echo esc_url(apply_filters('expert_makeup_stylist_topheader', $expert_makeup_stylist_our_products_btn_link_section)); ?>"><?php echo esc_html(apply_filters('expert_makeup_stylist_topheader', $expert_makeup_stylist_our_products_btn_section)); ?></a>
              <?php } ?>          
            </div>
        </div>
        <div class="col-lg-6 col-md-6 wow fadeInLeft" data-wow-delay="0.5s">
          <?php if (class_exists('woocommerce')) : ?>
            <div class="owl-carousel">
              <?php
              $selected_category = get_theme_mod('expert_makeup_stylist_our_product_product_category','product_cat1');
              if ($selected_category) {
                  $expert_makeup_stylist_args = array(
                      'post_type'      => 'product',
                      'posts_per_page' => 50,
                      'product_cat'    => $selected_category,
                      'order'          => 'ASC'
                  );
                  $loop = new WP_Query($expert_makeup_stylist_args);
                  while ($loop->have_posts()) : $loop->the_post();
              ?>
                  <div class="item">
                      <div class="product-box mb-5">
                          <?php global $product; ?>
                          <div class="product-content">
                              <h3 class="my-2"><a href="<?php the_permalink(); ?>"><?php echo esc_html(get_the_title()); ?></a></h3>
                              <p class="mb-2 product-price"><?php echo $product->get_price_html(); ?></p>
                              
                              <div class="product-rating">
                                  <?php if ($product->is_type('simple')) { woocommerce_template_loop_rating(); } ?>
                               </div>
                               <div class="product-description mb-3">
                                  <?php
                                  $content = get_the_content();
                                  $excerpt = wp_trim_words($content, 5);
                                  echo apply_filters('the_content', $excerpt);
                                  ?>
                              </div>
                              <div class="product-image position-relative">
                                  <?php echo woocommerce_get_product_thumbnail(); ?>
                                  <div class="add-to-cart-overlay position-absolute top-0 start-0 w-100 h-100 d-flex justify-content-center align-items-center">
                                      <?php if ($product->is_type('simple')) { woocommerce_template_loop_add_to_cart(); } ?>
                                  </div>
                              </div>
                          </div>
                      </div>
                  </div>
              <?php
                  endwhile;
                  wp_reset_postdata();
              }
              ?>
            </div>
          <?php endif; ?>
        </div>
      </div>
    </div>
  </div>
</section>
<?php } ?>
