任何人都知道如何自定义wooCommerce
ORDER DETAILS表并在其中添加产品(精选)图片?
我试图使用:
$img = wp_get_attachment_image_src( $item['product_id'] );
<img src="' . img[0] . '">'
woocommerce/templates/single-product/order-details.php
但它不起作用。
答案 0 :(得分:4)
在你的order-details.php中添加以下内容,我希望这对你有用。
echo get_the_post_thumbnail( $item['product_id'], 'full' );
答案 1 :(得分:0)
order-details.php位于/ wp-content / plugins / woocommerce / templates / order文件夹中。 您必须将其复制到wp-content / themes / your-theme / woocommerce / order文件夹。
添加以下行: echo $ thumbnail = apply_filters(&#39; woocommerce_in_cart_product_thumbnail&#39;,$ _product-&gt; get_image());
在包含此文字的行之前: echo apply_filters(&#39; woocommerce_order_item_name&#39;
干得好!