Loop doesn’t work in single-product.php page but works at normal page

A part of the problem was that “caller_get_posts” is deprecated, it is now “ignore_sticky_posts”.

The main problem was this line “$post_type = $wp->query_vars[“product”];”, i removed this one and replaced the $post_type with ‘product’.

This code works!

  <?php  
  $tax = 'product_category';
  $tax_terms = get_terms($tax,'hide_empty=0');

  if (is_array($tax_terms)) {
    foreach ($tax_terms  as $tax_term) {
      $args=array(
        'post_type' => 'product',
        "$tax" => $tax_term->slug,
        'post_status' => 'publish',
        'posts_per_page' => -1,
        'ignore_sticky_posts'=> 1
      );
      $my_query = new WP_Query($args);
      if ( $my_query->have_posts() ) {
        echo "<li><div>$tax_term->name</div>";
        echo "<ul>";
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <li><a href="https://wordpress.stackexchange.com/questions/39947/<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php  $delta_article_number = get_post_meta( get_the_ID( ), 'delta_article_number', true );  echo $delta_article_number;  ?> <?php the_title(); ?></a></li>
          <?php
        endwhile;
        echo "</ul></li>";
      }

    }
  }
  wp_reset_postdata();  wp_reset_query();
  ?>