我有一个电子商务应用程序,几天前运行良好。在我更新 wordpress 和 woocommerce 插件后,该应用程序突然停止工作。
\n我认为这与我使用的插件(mstore app-mobile)有关,但不幸的是无法更新此插件。
\n错误发生在此 updateCartQty 函数上。我的猜测是关于函数参数的一些事情。
\npublic function updateCartQty()\n{ \n $cart_item_key = $_REQUEST[\'key\'];\n $qty = (int)$_REQUEST[\'quantity\'];\n\n global $woocommerce;\n $woocommerce->cart->set_quantity($cart_item_key, $qty); \n $this->cart(); \n}\nRun Code Online (Sandbox Code Playgroud)\n这是日志文件:
\n2021-02-22T23:43:48+00:00 CRITICAL Uncaught Error: Call to a member function get_tax_class() on null in /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:225\nStack trace:\n#0 /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(651): WC_Cart_Totals->get_items_from_cart()\n#1 /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(143): WC_Cart_Totals->calculate_item_totals()\n#2 /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(134): WC_Cart_Totals->calculate()\n#3 /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1369): WC_Cart_Totals->__construct()\n#4 /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1328): WC_Cart->calculate_totals()\n#5 /var/www/html/ecommerce/htdocs/wp-content/plugins/mstoreapp-mobile-app-multivendor/public/class-mstoreapp-mobile-app-public.php(1277): WC_Cart->set_quantity()\n#6 , em /var/www/html/ecommerce/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php, na linha 225\nRun Code Online (Sandbox Code Playgroud)\n系统信息:
\nWC Version: 5.0.0\nREST API Version: \xe2\x9c\x94 5.0.0\nWC Blocks Version: \xe2\x9c\x94 4.0.0\nAction …Run Code Online (Sandbox Code Playgroud)