如果客户已经通过 Paypal 付款,我想更改感谢页面的文本。 通过 PayPal 重定向工作正常。订单状态为“处理中”,ok。 但是如何更改重定向页面上的感谢文本 ( https://www.example.com/checkout/order-received/ )
我尝试了以下方法,但没有成功:
function my_update_order_status() {
$order = new WC_Order($order_id);
if ($order_status == 'processing')
echo 'NEW MESSAGE';
else
echo 'NOT PAID TEXT';
}
add_filter('woocommerce_thankyou_order_received_text', 'my_update_order_status', 10, 2);
最佳答案
这里有关于如何更改感谢页面的说明:
https://wordpress.org/support/topic/how-to-edit-the-thank-youorder-received-page
如果你不想做任何模板修改,那么你可以包含订单接收功能来调整它。例如:
function isa_order_received_text( $text, $order ) {
$new = $text . ' All received and an email is on its way to you!.';
return $new;
}
add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );
上面将文本添加到当前文本输出。
关于redirect - Woocommerce - 使用 IPN 从 PayPal 重定向后更改订单收到的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33855419/