【问题标题】:WooCommerce, Add to cart not working, and cart page not displayingWooCommerce,添加到购物车不起作用,并且购物车页面未显示
【发布时间】:2012-10-24 11:38:37
【问题描述】:

我是 WooCommerce 的新手,虽然前几天添加到购物车和购物车页面显示正常。我现在发现转到我的购物车页面会显示一个空白页面。

有谁知道什么会导致此类问题?

【问题讨论】:

    标签: wordpress woocommerce cart


    【解决方案1】:

    您的购物车页面网址怎么样? 您是否已经在 wordpress 中设置了永久链接?

    设置 > 固定链接设置 > 帖子名称

    自动显示 /%postname%/

    【讨论】:

      【解决方案2】:

      将此代码添加到您的function.php中:

      add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3);
      function my_expiration_filter($seconds, $user_id, $remember){
      //if "remember me" is checked;
      if ( $remember ) {
          //WP defaults to 2 weeks;
          $expiration = 14*24*60*60; //UPDATE HERE;
      } else {
          //WP defaults to 48 hrs/2 days;
          $expiration = 2*24*60*60; //UPDATE HERE;
      }
      
      //http://en.wikipedia.org/wiki/Year_2038_problem
      if ( PHP_INT_MAX - time() < $expiration ) {
          //Fix to a little bit earlier!
          $expiration =  PHP_INT_MAX - time() - 5;
      }
      
      return $expiration;
      

      }

      【讨论】:

      • add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3);函数 my_expiration_filter($seconds, $user_id, $remember){ if ( $remember ) { $expiration = 14*24*60*60; //这里更新; } 其他 { $expiration = 2*24*60*60; //这里更新; } if ( PHP_INT_MAX - time()
      猜你喜欢
      • 1970-01-01
      • 2016-03-30
      • 1970-01-01
      • 2012-09-27
      • 1970-01-01
      • 1970-01-01
      • 2013-07-15
      • 2023-02-18
      • 2020-10-28
      相关资源
      最近更新 更多