I get the product variations each as their own button with below code that I have pieced together. Echo $product->name outputs something like "Product - variation" but I need "Variation price". Price would be entered in description field in the dashboard. I have gone through several related questions and answers but I'm not skilled enough to apply the solutions to my code so help would be appreciated!
<?php $params = array('posts_per_page' => -1, 'post_type' => 'product_variation', 'order' => 'ASC'); $wc_query = new WP_Query($params); ?> <?php if ($wc_query->have_posts()) : ?> <?php while ($wc_query->have_posts()) : $wc_query->the_post(); ?> <form class="cart" action="<?php the_permalink() ?>" method="post" enctype="multipart/form-data"> <input type="hidden" name="add-to-cart" value="<?php echo esc_attr($product->id); ?>"> <button <?php post_class('button') ?> type="submit"><strong><?php echo $product->name ?> </strong></button> </form> <?php endwhile; ?> <?php wp_reset_postdata(); ?> <?php else: ?> <div> <?php _e( 'No Products' ); ?> </div> <?php endif; ?>