在 WooCommerce 我的帐户查看订单页面上的订单详细信息下添加自定义文本 [英] Add custom text under order details on WooCommerce My account view order pages
本文介绍了在 WooCommerce 我的帐户查看订单页面上的订单详细信息下添加自定义文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在 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:
要在 30 天试用期内取消您的许可证,请点击退款我的整个订单"
To cancel your license within the 30 day trial period click REFUND MY ENTIRE ORDER
我怎样才能做到这一点?
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>' );
}
}
代码位于活动子主题(或活动主题)的 function.php 文件中.经测试有效.
Code goes in function.php file of your active child theme (or active theme). Tested and works.
这篇关于在 WooCommerce 我的帐户查看订单页面上的订单详细信息下添加自定义文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文