admin管理员组文章数量:1327713
I am displaying logged in users their order history in the front end. Initially, when no order history, I used to get a blank page. However, after using this code
if ( !$customer_orders ) :
echo esc_html("You haven't redeemed any offer");
endif;
I can display a message in the front-end saying "You haven't redeemed any offer" I want this page to redirect after 5 seconds on if this message is being displayed, otherwise users will get to see their order details.
Can someone suggest something or extend this code? Check out the images for referenceWhere redirection has to happen after 5 seconds
I am displaying logged in users their order history in the front end. Initially, when no order history, I used to get a blank page. However, after using this code
if ( !$customer_orders ) :
echo esc_html("You haven't redeemed any offer");
endif;
I can display a message in the front-end saying "You haven't redeemed any offer" I want this page to redirect after 5 seconds on if this message is being displayed, otherwise users will get to see their order details.
Can someone suggest something or extend this code? Check out the images for referenceWhere redirection has to happen after 5 seconds
Share Improve this question asked Aug 2, 2020 at 18:09 Mohiz AhmadMohiz Ahmad 11 Answer
Reset to default 0Since you are looking for a redirect after 5 seconds so for this you need to use javascript timeout. You can enqueue script as per standards. Adding this script inside the condition of no orders will do the task.
jQuery(document).ready(function ($) {
window.setTimeout(function () {
location.href = "REDIRECT URL HERE";
}, 5000);
});
本文标签: pluginsWoocommerce redirection if no previous orders
版权声明:本文标题:plugins - Woocommerce redirection if no previous orders 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742214892a2434387.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论