douyin2883 2019-03-01 16:57 采纳率: 0%
浏览 676
已采纳

在WooCommerce我的帐户查看订单页面上的订单详细信息下添加自定义文本

I need to add some custom text under the Order Details section of the WooCommerce view-order page.

My goal here is to add some additional instructions:

To cancel your license within the 30 day trial period click REFUND MY ENTIRE ORDER

How might I accomplish this?

  • 写回答

1条回答 默认 最新

  • dongrang9300 2019-03-01 19:53
    关注

    Try the following to display a custom text in "View Order" pages:

    add_action('woocommerce_order_details_after_order_table', 'action_order_details_after_order_table', 10, 4 );
    function action_order_details_after_order_table( $order, $sent_to_admin = '', $plain_text = '', $email = '' ) {
        // Only on "My Account" > "Order View"
        if ( is_wc_endpoint_url( 'view-order' ) ) {
            printf( '<p class="custom-text">' .
            __("To cancel your license within the 30 day trial period click on %s" ,"woocommerce"),
            '<strong>"' .__("Refund my entire order", "woocommerce") . '"</strong>.</p>' );
        }
    }
    

    Code goes in function.php file of your active child theme (or active theme). Tested and works.

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

报告相同问题?

悬赏问题

  • ¥15 工创大赛太阳能电动车项目零基础要学什么
  • ¥20 limma多组间分析最终p值只有一个
  • ¥15 nopCommerce开发问题
  • ¥15 torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGKILL
  • ¥15 QuartusⅡ15.0编译项目后,output_files中的.jdi、.sld、.sof不更新怎么解决
  • ¥15 pycharm输出和导师的一样,但是标红
  • ¥15 想问问富文本拿到的html怎么转成docx的
  • ¥15 我看了您的文章,遇到了个问题。
  • ¥15 GitHubssh虚拟机连接不上
  • ¥15 装完kali之后下载Google输入法 重启电脑后出现以下状况 且退不出去 桌面消失 反复重启没用