我需要将Woocommerce购物车的到期时间增加到72小时。
我已尝试过此处建议的解决方案:set wordpress woocommerce cart expiration
但我看不到任何结果:( 任何人都可以帮我解决这个问题吗?
由于
- 编辑:代码段---
$result = file_get_contents("https://www.lottery.ie/dbg/results/view?game=daily-million&draws=1") ;
$bonusNumber = $ex3 = '';
/* * **** Result Get With url********* */
if ($result) {
$ex1 = explode('<section class="matching-draw">', $result);
if ($ex1['1']) {
$ex2 = explode('<h4>', $ex1['1']);
$ex3 = explode('</h4>', $ex2['1']); /* * **Date get here*** */
}
}
if (!empty($ex3)) {
$dateVal = $ex3['0'];
$allNumber = explode('<h5>WINNING NUMBERS</h5>', $ex3['1']);
$allNumber1 = explode('<div class="pick-number">', $allNumber['1']); //pr($allNumber1);
foreach ($allNumber1 as $no) {
$ball[] = explode('</div>', $no);
}
$ex4 = explode('<h5>BONUS</h5>', $ex3['1']);
if ($ex4) {
$ex5 = explode('</div>', $ex4['1']);
if ($ex5) {
$ex6 = explode('<div class="pick-number">', $ex5['0']);
$bonusNumber = $ex6['1']; /* * ****Final Bonus Number******** */
}
}
}
if (!empty($bonusNumber)) {
echo 'Winning Numbers<br/>';
echo $ball['1']['0'] . ' ' . $ball['2']['0'] . ' ' . $ball['3']['0'] . ' ' . $ball['4']['0'] . ' ' . $ball['5']['0'] . ' ' . $ball['6']['0'] . '<br/>';
echo 'Bonus<br/>';
echo $bonusNumber;
答案 0 :(得分:3)
过滤器必须以秒为单位返回72小时。
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;
}
答案 1 :(得分:0)
我在多站点设置中遇到了这个问题并构建了一个插件来解决这个问题。您可以在此处获取插件http://mtrl.co.uk/shop/product/woocommerce-cart-lifespan-settings-plugin/