当前位置: 首页 > 知识库问答 >
问题:

未捕获的ArgumentCountError:参数太少,无法wc_get_page_id()

池永长
2023-03-14

当我的WooCommerce购物车页面为空时,我会在页面上出现此错误,我如何消除此错误消息?

致命错误:未捕获的ArgumentCountError:参数太少,无法执行wc_get_page_id(),0在第30行 /home/s3morder/public_html/wp-content/themes/Intranet主题/伍兹商业/购物车/cart-empty.php中传递,而在 /home/s3morder/public_html/wp-content/plugins/woocommerce/includes/<--plhd-中预期为11/>堆栈跟踪:#0 /home/s3morder/public_html/wp-content/themes/Intranet主题/WooCommerce/购物车/cart-empty.php(30):wc_get_page_id()#1 /home/s3morder/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(211):包括('/home/s3morder/...')#2 /home/s3morder/public_html/wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-cart.php(85):wc_get_template('购物车/购物车-空...')#3 /home/s3morder/public_html/wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php(76):WC_Shortcode_Cart::输出(数组)#4 /home/s3morder/public_html/wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php(89):WC_Shortcodes::shortcode_wrapper(Array)#5 /home/s3morder/public_html/wp- /home/s3morder/public_html/wp-content/plugins/woocommerce/includes/wc-page-functions.phpon line 45

提前感谢!

共有1个答案

令狐辉
2023-03-14

我发现empty-cart.php中有一个额外的函数我还没有删除,一旦我缩小了错误的起始位置,我就知道需要删除什么,cart-empty.php文件如下所示。

<?php

   if ( ! defined( 'ABSPATH' ) ) {
      exit; // Exit if accessed directly
   }
?>
<div class="text-center">
   <?php do_action( 'woocommerce_cart_is_empty' );?>
</div>

给出的响应是您的购物车当前是空的。这太完美了!我希望这对别人有帮助!

 类似资料: