简体   繁体   English

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

[英]Add custom text under order details on WooCommerce My account view order pages

I need to add some custom text under the Order Details section of the WooCommerce view-order page. 我需要在WooCommerce查看顺序页面的“订单详细信息”部分下添加一些自定义文本。

My goal here is to add some additional instructions: 我的目标是添加一些其他说明:

To cancel your license within the 30 day trial period click REFUND MY ENTIRE ORDER 要在30天的试用期内取消许可证,请单击“退款我的全部订单”

How might I accomplish this? 我该怎么做?

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). 代码进入您的活动子主题(或活动主题)的function.php文件中。 Tested and works. 经过测试和工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Woocommerce 的我的帐户订单视图页面上添加 sku 以订购商品 - Add the sku to order items on my account order view pages in Woocommerce WooCommerce -Thankyou 和“我的帐户”查看订单页面上的自定义通知 - WooCommerce - Custom notice on Thankyou and "My account" view order pages 在 WooCommerce 中编辑我的帐户订单视图页面 - Editing My account Order view pages in WooCommerce woocommerce 在运输表下添加自定义字段(我的帐户订单视图/谢谢) - woocommerce Adding custom field under shipping table (my account-order view/ thank you) 在 Woocommerce 3 中的我的帐户订单查看页面上显示付款说明 - Display payment instructions on my account order view pages in Woocommerce 3 Woocommerce我的帐户订单详细信息 - Woocommerce My-account order details 在 WooCommerce 我的帐户中更改标题自定义“查看订单”端点 - Change title custom "view-order" endpoint in WooCommerce My account 在 WooCommerce 我的账户订单自定义栏目中添加“支付订单”按钮 - Add “Pay for order” Button in WooCommerce My account Orders Custom Column 在 Woocommerce 编辑订单页面添加自定义行 - Add a custom row in Woocommerce edit order pages 在WooCommerce上添加支付订单按钮我的账户查看订单挂单 - Add a pay order button on WooCommerce My account view order for pending orders
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM