我需要在订单页面中显示产品摘要。我花了几个小时试图找到一个解决方案,但没有。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