Woocommerce - description in products page

怎甘沉沦 提交于 2019-12-04 14:34:40

问题


I need to add little excerpt from description on my "product" in Woocommerce plugin. I have page like this: http://exploreprague.cz/guides-buddies-2/ and I need to have some description text under the name of each person... is there any way to do it?


回答1:


That category page with the products inside is: woocommerce >> templates >> content-product.php

And you can find that only function to show the Title inside this page as:

<h3><?php the_title(); ?></h3>

After that line you can add your own lines:

<br /><?php echo $product->get_sku(); ?> <br /><?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>

These will display the SKU and the short-description of the product.

Btw, this is just a quick hard-coded method, you can try to add these functions to the hook on that page in your theme's functions.php.

add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);

As it is mentioned in that hooks comments section that the PRICE is already hooked in there.




回答2:


Maybe this can help you

<?php wc_get_template( 'single-product/short-description.php' ); ?>

from this link https://docs.woothemes.com/wc-apidocs/function-woocommerce_template_single_excerpt.html



来源:https://stackoverflow.com/questions/15479712/woocommerce-description-in-products-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!