What I'm trying to do is show the price besides the title of the product in a related products list that is in the sidebar... but it doesn't work for some reason.
Yes, I have searched the StackOverflow archive and Google and found the obvious answer:
<?php echo $product->get_price_html(); ?>
but this one doesn't work in my code structure:
<h4>Related products</h4>
<ul class="prods-list">
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>" target="_blank">
<?php do_action( 'woocommerce_before_shop_loop_item_title' ); ?>
<span><?php the_title(); ?></span>
/a>
</li>
<?php endwhile; wp_reset_postdata(); ?>
</ul>
What am I doing wrong here? I tried adding that code after the title span, but it doesn't return anything.