WooCommerce shows the placeholder image when using get_image()
问题 I am developing a custom WooCommerce theme and every time I try to retrieve a product's image, all I get is the placeholder image. I've already set the image in the back-end so it should work properly, but it doesn't. Here is my code: $args = array( 'post_type' => 'product', 'posts_per_page' => 2 ); $products = get_posts($args); foreach($products as $the_product) { $wc_product = new WC_Product($the_product->id); echo $wc_product->get_image('shop_thumbnail'); } This is the result: Could you