wooCommerce如何在ORDER DETAILS表中添加特色图像


wooCommerce how to add featured image in ORDER DETAILS table

有人知道如何自定义wooCommerce ORDER DETAILS表并在其中添加产品(特色)图像吗?

我尝试使用:

$img = wp_get_attachment_image_src( $item['product_id'] );
<img src="' . img[0] . '">'
woocommerce/templates/single-product/order-details.php

在您的order-details.php中添加以下内容,我希望这对您也有效。

echo get_the_post_thumbnail( $item['product_id'], 'full' ); 

order-details.php位于/wp-content/plugins/woocommerce/templates/order文件夹中。你必须把它复制到wp-content/themes/your-theme/woocommerce/order文件夹。

然后添加以下行:Echo $thumbnail = apply_filters('woocommerce_in_cart_product_thumbnail', $_product->get_image());

在包含此文本的行之前:Echo apply_filters('woocommerce_order_item_name'

做得好!