我需要在訂單頁面中顯示產品摘要。我花了幾個小時試圖找到一個解決方案,但沒有。Woocommerce - 在訂單頁面中顯示產品摘錄頁面
我已經顯示出圖像&標題的產品(感謝@helgatheviking &這個thread),但我不能讓摘錄顯示。這是我的代碼:
<div id="order-column" class="my_account_orders">
<div class="wrap">
<?php
foreach ($customer_orders as $customer_order) {
$order = wc_get_order();
$order->populate($customer_order);
foreach($order->get_items() as $item_id => $item) {
$product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item);
$product->get_image();
$product->get_title();
}
$item_count = $order->get_item_count();
?>
<div class="orders-wrap">
<div class="preview">
<div class="image">
<div class="image-wrap"><?php echo $product->get_image(); ?></div>
</div>
<div class="bottom">
<div class="details">
<h3 class="name"><a title="View Order" href="<?php echo $order->get_view_order_url(); ?>"><?php echo $product->get_title(); ?></a></h3>
<h4 class="subtitle"><?php the_excerpt(); ?></h4>
</div>
</div>
摘錄應出現在subtitle
。 我已經確認並嘗試在這些線程的建議: Woocommerce - description in products page Adding a product description to the woocommerce cart page
總是值得考慮看看WooCommerce本身如何爲[顯示數據](https://github.com/woothemes/woocommerce/blob/master/templates/single-product/short-description.php#L22 )。而對於字幕,請看看[我寫的插件](https://wordpress.org/plugins/kia-subtitle/) – helgatheviking