douban2014 2014-10-30 10:30
浏览 22

未在商店页面显示的产品的简短描述(archive-product.php)

I have been trying to figure out how I can display the short description for each product at the shop page(archive-product.php).

Here in this screenshot you can see i have placed a dummy text at the short description field.

http://i255.photobucket.com/albums/hh140/testament1234/excerpt_zpse08fd1d6.jpg

But it doesn't reflect on the shop page. It only shows the product price, rating and also add to cart button

http://i255.photobucket.com/albums/hh140/testament1234/description_zps916077d0.jpg.

I have already copied the woocommerce templates files and placed them at woocommerce folder in the root of my theme

UPDATE:

 //ADD SHORT DESCRIPTION SHOP PAGE
if ( ! function_exists( 'add_product_description' ) ) {
    function woocommerce_template_loop_price() {
            wc_get_template( 'single-product/short-description.php' );
        }
    }
  • 写回答

1条回答 默认 最新

  • dptgpyl61857413 2014-10-30 10:53
    关注

    You can achieve this using the woocommerce_after_shop_loop_item action hook. In woocommerce you can define your own function which will trigger and add the description to your product. To achieve this ,use

    add_action( 'woocommerce_after_shop_loop_item', 'add_product_description');
    
    if ( ! function_exists( 'add_product_description' ) ) {
        function add_product_description() {
                wc_get_template( 'loop/product_description_snippet.php' );
        }
    }
    

    Create a file product_description_snippet.php(inside the theme/woocommerce/loop) ,where you can add code to grab product description.

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂