Home › Forums › WoodMart support forum › Call to a member function get_tax_class() on null in /class-wc-cart-totals.php
Call to a member function get_tax_class() on null in /class-wc-cart-totals.php
- This topic has 8 replies, 2 voices, and was last updated 11 months, 3 weeks ago by Artem Temos.
-
AuthorPosts
-
December 27, 2023 at 4:15 pm #524938
radchuk2012ParticipantGreetings!
I noticed for a long time that there is a floating failure appearing in the wc-status log:2023-12-27T09:43:43+00:00 CRITICAL Uncaught Error: Call to a member function get_tax_class() on null in /web/sites/zyabkin.ua/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:232
Stack trace:
#0 /web/sites/zyabkin.ua/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(658): WC_Cart_Totals->get_items_from_cart()
#1 /web/sites/zyabkin.ua/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(150): WC_Cart_Totals->calculate_item_totals()
#2 /web/sites/zyabkin.ua/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(141): WC_Cart_Totals->calculate()
#3 /web/sites/zyabkin.ua/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1408): WC_Cart_Totals->__construct(Object(WC_Cart))
#4 /web/sites/zyabkin.ua/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/quantity.php(57): WC_Cart->calculate_totals()
#5 /web/sites/zyabkin.ua/wp-includes/class-wp-hook.php(324): woodmart_update_cart_item(”)
#6 /web/sites/zyabkin.ua/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array)
#7 /web/sites/zyabkin.ua/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 /web/sites/zyabkin.ua/wp-admin/admin-ajax.php(203): do_action(‘wp_ajax_nopriv_…’)
#9 {main}
thrown у /web/sites/zyabkin.ua/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php доступно 232I was not able to reproduce the error, but users periodically experience crashes that I see in the log – I assume that the problem is due to abandoned carts, but I’m not sure.
I need your help!
Authorization data in private content.
Thank you!
December 27, 2023 at 5:14 pm #524956
radchuk2012ParticipantSome more information from nginx in the attached file
Attachments:
You must be logged in to view attached files.December 27, 2023 at 5:55 pm #524972
Artem TemosKeymasterHello,
Please, send us your FTP access so we can troubleshoot this on your website.
Kind Regards
December 27, 2023 at 6:10 pm #524981
radchuk2012ParticipantI looked at the nginx access log and built a chain simulating a failure:
1) This request was received after emptying the woodmart quick cart (woocommerce-mini-cart) by deleting the last item:
Answer from “action=woodmart_update_cart_item”
{“fragments”:{“div.widget_shopping_cart_content”:”<div class=\”widget_shopping_cart_content\”>\n<div class=\”shopping-cart-widget-body wd-scroll\”>\n\t<div class=\”wd-scroll-content\”>\n\n\t\t\n\t\t\t<div class=\”wd-empty-mini-cart\”>\n\t\t\t\t<p class=\”woocommerce-mini-cart__empty-message empty title\”>Немає товарів у кошику.<\/p>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tПовернутися до магазину\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t<\/div>\n\n\t\t\n\t<\/div>\n<\/div>\n\n<div class=\”shopping-cart-widget-footer wd-cart-empty\”>\n\t\n\t<\/div>\n<\/div>”,”span.wd-cart-number_wd”:”\t\t<span class=\”wd-cart-number wd-tools-count\”>0 <span><\/span><\/span>\n\t\t”,”span.wd-cart-subtotal_wd”:”\t\t<span class=\”wd-cart-subtotal\”><span class=\”woocommerce-Price-amount amount\”><bdi>0,00 <span class=\”woocommerce-Price-currencySymbol\”>₴<\/span><\/bdi><\/span><\/span>\n\t\t”},”cart_hash”:””}2) Then a second GET is received with the same “item_id”, but “qty=1” and we get an error 500 which is reported in the logs (wc-status, nginx) – Thereby simulating crash for debugging purposes.
3) It seems that php does not check for a non-existent item_id with quantity – Probably here:
/web/sites/zyabkin.ua/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/quantity.php
- This reply was modified 11 months, 3 weeks ago by radchuk2012.
- This reply was modified 11 months, 3 weeks ago by radchuk2012.
- This reply was modified 11 months, 3 weeks ago by radchuk2012.
December 27, 2023 at 6:48 pm #524997
radchuk2012ParticipantFTP
December 27, 2023 at 7:21 pm #525007
radchuk2012ParticipantApplied your patch – 524995
FIXED: “Update cart item” ajax action after cleaning the cart.
The 500 error no longer seems to cause.
Please let me know when access is no longer needed…
Probably the topic can be closed… it will take a long time to catch an error on the user’s side
Thanks for the quick fix!December 28, 2023 at 10:09 am #525091
Artem TemosKeymasterYes, this patch was created for this error. If it is fixed then let me know and I will close the topic.
Kind Regards
December 28, 2023 at 12:48 pm #525147
radchuk2012ParticipantGreetings!
I was no longer able to simulate a failure (500) with this request:I consider the problem closed, the topic can be closed.
Thank you!
December 28, 2023 at 3:44 pm #525205
Artem TemosKeymasterOK, great. We close this topic. Feel free to open a new one if you face any issues.
-
AuthorPosts
Tagged: cart
The topic ‘Call to a member function get_tax_class() on null in /class-wc-cart-totals.php’ is closed to new replies.
- You must be logged in to create new topics. Login / Register