Woocommerce 设置购物车到期间隔 [英] Woocommerce Set Cart Expiration Interval
本文介绍了Woocommerce 设置购物车到期间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将 Woocommerce 购物车的过期时间增加到 72 小时.
I need to increase the expiration time of Woocommerce cart to 72 hours.
我已经尝试过这里建议的解决方案:设置 wordpress woocommerce 购物车到期
I've tried the solution suggested here: set wordpress woocommerce cart expiration
但是我看不到任何结果:(有人能帮我解决这个问题吗?
But I can't see any result :( Can anyone help me to get this working?
谢谢
-- 代码片段 ---
-- Code snippet ---
add_filter('wc_session_expiring', 'filter_ExtendSessionExpiring' );
add_filter('wc_session_expiration' , 'filter_ExtendSessionExpired' );
function filter_ExtendSessionExpiring($seconds) {
return (60 * 60 * 24 * 4) - (60 * 60);
}
function filter_ExtendSessionExpired($seconds) {
return 60 * 60 * 24 * 4;
}
推荐答案
过滤器必须返回 72 小时,以秒为单位.
The filter must return 72 hours, in seconds.
add_filter('wc_session_expiring', 'filter_ExtendSessionExpiring' );
add_filter('wc_session_expiration' , 'filter_ExtendSessionExpired' );
function filter_ExtendSessionExpiring($seconds) {
return 60 * 60 * 71;
}
function filter_ExtendSessionExpired($seconds) {
return 60 * 60 * 72;
}
这篇关于Woocommerce 设置购物车到期间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文