[英]Woocommerce thankyou page is not working after checkout
Today I ran into an interesting issue.今天我遇到了一个有趣的问题。 After payment thankyou page is not displayed.
付款后不显示感谢页面。 There is only white screen with menu.
只有带菜单的白屏。 You can see it in the screenshot.
您可以在屏幕截图中看到它。 thankyou page http://prntscr.com/ofpnuu I tried to create a custom thankyou page and tried to redirect it from the function.php but nothing happened.
感谢页面 http://prntscr.com/ofpnuu我尝试创建一个自定义的感谢页面并尝试从 function.php 重定向它,但没有任何反应。 Then I installed the plugin to create thankyou page but again nothing happened.
然后我安装了插件来创建谢谢页面,但再次没有发生任何事情。 I have run out of ideas.
我已经没有想法了。 Can someone tell me how to solve this issue.
有人可以告诉我如何解决这个问题。
Use the hook below to redirect to the thank you page.使用下面的钩子重定向到感谢页面。 Create a thank you page and redirect to that url...
创建一个感谢页面并重定向到该网址...
Check the code below:检查下面的代码:
add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' );
function wc_custom_redirect_after_purchase() {
global $wp;
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( 'http://www.yoururl.com/your-page/' );
exit;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.