duanditang2916 2016-10-23 21:49
浏览 145
已采纳

在Woocommerce单一产品布局中更改价格位置

I'm looking for assistance in changing the layout of my woocommerce single product page. I want to coming price under description but in The Single Product Page layout isn't it .

How can I do it?

Thanks.

  • 写回答

1条回答 默认 最新

  • dongxu1029 2016-10-23 22:18
    关注

    If you have a look to the WooCommerce content-single-product.php template file in this extract:

    <?php
        /**
         * woocommerce_single_product_summary hook.
         *
         * @hooked woocommerce_template_single_title - 5
         * @hooked woocommerce_template_single_rating - 10
         * @hooked woocommerce_template_single_price - 10
         * @hooked woocommerce_template_single_excerpt - 20
         * @hooked woocommerce_template_single_add_to_cart - 30
         * @hooked woocommerce_template_single_meta - 40
         * @hooked woocommerce_template_single_sharing - 50
         */
        //do_action( 'woocommerce_single_product_summary' );
    

    You will see that the related template regarding price is hooked in woocommerce_single_product_summary with a priority of 10. So yo have to remove it and to hook it again changing the priority between 20 and 30, to have it under description.

    You just need to add this little code snippet to the function.php file of your active child theme (or active theme):

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );
    

    This code is tested and works.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程