admin管理员组文章数量:1193979
I would like to add a text in the checkout page in this part:
I tried to use this hook:
function wh_test_1($order_id) { //<--check this line
//create an order instance
$order = wc_get_order($order_id); //<--check this line
$paymethod = $order->payment_method_title;
$orderstat = $order->get_status();
echo "teste";
}
but the word "teste" appear in this part:
Somone can help me?
I would like to add a text in the checkout page in this part:
I tried to use this hook:
function wh_test_1($order_id) { //<--check this line
//create an order instance
$order = wc_get_order($order_id); //<--check this line
$paymethod = $order->payment_method_title;
$orderstat = $order->get_status();
echo "teste";
}
but the word "teste" appear in this part:
Somone can help me?
Share Improve this question asked Aug 23, 2022 at 18:39 Rodrigo FrancoRodrigo Franco 31 bronze badge1 Answer
Reset to default 2You have two options. You can use the hook woocommerce_before_thankyou
hook to add some html before "Obrigado. Seu pedido foi recebido" or you can replace the that thankyou text with any html you want with the hook woocommerce_thankyou_order_received_text
If you want to use woocommerce_before_thankyou (NOTE: this hook will fire also on failed orders, but you can check inside the hook if the order is failed with the $order_id):
function test_hook_before_thankyou($order_id) {
echo "teste";
}
add_action( 'woocommerce_before_thankyou', 'test_hook_before_thankyou' );
If you want to replace that text with the hook woocommerce_thankyou_order_received_text:
function test_hook_replace_thankyou ( $thank_you_msg, $order_obj) { /* here you have the full order object, no only the id */
$thank_you_msg = 'This is your new thank you message';
$thank_you_msg .= '<br><b>You can add html too</b>';
return $thank_you_msg;
}
add_filter( 'woocommerce_thankyou_order_received_text', 'test_hook_replace_thankyou' );
本文标签: pluginsHow to add a text in the checkout page woocomerce
版权声明:本文标题:plugins - How to add a text in the checkout page woocomerce? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738451197a2087494.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论