• Resolved mattb150

    (@mattb150)


    When I add an item to the cart, I get an HTTP500 page. WP in debug mode reads out the following:

    [Thu Oct 12 17:05:46 2017] [hphp] [9622:7ffbbbfff700:132:000001] [] \nNotice: WC_Cart->fees is deprecated since version 3.2! Use Fees should only be added through the Fees API (WC_Cart::add_fee()) instead. in /var/www/wordpress/wp-includes/functions.php o$
    [Thu Oct 12 17:05:46 2017] [hphp] [9622:7ffbbbfff700:132:000002] [] \nNotice: Undefined property: WC_Cart::$fees in /var/www/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1759
    [Thu Oct 12 17:05:46 2017] [hphp] [9622:7ffbbbfff700:132:000003] [] \nFatal error: Invalid operand type was used: cannot perform this operation with arrays in /var/www/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1759

    Anyone have any insight into what is going down here? I’ve been poking at it for a bit now to no avail.

    • This topic was modified 8 years, 8 months ago by mattb150.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Claudiu Lodromanean

    (@claudiulodro)

    It looks like one of your other plugins is trying to add fees (and may be doing it in a weird way that broke with the latest update). This is where the errors are coming from: https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-cart.php#L1754-L1762

    Do you know which active plugin of yours would be trying to add fees to the cart?

    Thread Starter mattb150

    (@mattb150)

    I am using WooCommerce Bookings & Product Add-Ons, but other than those two I can’t think of one that has anything to do with checkout or fees at all. But it’s very good to know it must be a plugin, I can goo through one by one and eliminate. I already tried deactivating Add-Ons, suspecting it was causing it, but nothing changed.

    Thread Starter mattb150

    (@mattb150)

    I deactivated every plugin other than WooCommerce and the error persists. I switched themes to Twenty-Seventeen as well, and the error persists. Any other thoughts?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Any customisations elsewhere, such as drop-ins folder? Has customisation been made to Twenty-Seventeen or anything?

    The line in question see’s if someone has added fees the ‘old way’. $this->fees Core does not do this and i’d expect to see the issue on other sites if it wasn’t custom code on your site. If you do find the code, please share it so I can review why it errors instead of failing gracefully.

    Thread Starter mattb150

    (@mattb150)

    I just dug for a while a no, from what I can see it is bare-bones Twenty-Seventeen, which I leave un-edited for testing when stuff breaks. WooCommerce is the only active plugin, there are no drop-ins active.

    Is there anything else I might try in the way of troubleshooting? Are there any logs I could dig into/provide here that might shed more light than WPs debug.log?

    Plugin Contributor Gerhard Potgieter

    (@kloon)

    You mentioned you are running Bookings and Addons, did you test with those disabled? Like the others mentioned this has to be some code or a plugin that is using outdated calls. I’d try and disable all plugins except woocommerce and perhaps switch to a standard theme not in use like Storefront and then see if you still get the error.

    Chances are that you are either running outdated extensions, which will need to be updated, or you might have some custom code running in your theme causing this.

    I cannot reproduce the error with just WooCommerce and a standard theme like Twenty Seventeen or Storefront.

    Thread Starter mattb150

    (@mattb150)

    I went in through shell and manually removed all plugins except woocommerce, then downloaded fresh version of Storefront theme. Error is persisting as written above even in this environment. Where else could modification possibly be coming from, if not from a plugin (none others are active) or a theme (Storefront is totally vanilla)? I’m really not sure where to search from here. Could a plugin I’ve used in the past have caused a permanent issue that would endure even after it is deactivated and removed? Could custom code from the theme I normally use stick around even after the theme is changed? It must be coming from somewhere…

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Are you on HHVM or PHP?

    I’d try 3.2.1 when it’s out shortly. We’ve tweaked the fees deprecation code. If it doesn’t help we could try some extra debugging to see what is calling it.

    Thread Starter mattb150

    (@mattb150)

    HHVM. I will patiently await 3.2.1, and I really appreciate all the help so far everyone.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Actually then, since you have a HHVM install and I cannot test it, and to save me needing to do another patch release, could you test this PR?

    https://github.com/woocommerce/woocommerce/pull/17193

    If that works I’ll go ahead and release 3.2.1 tonight.

    Thread Starter mattb150

    (@mattb150)

    Mike, your new commit seems to have solved my issue. YOU’RE THE MAN!

    Nice work & thank you! I’ll consider switching to PHP given WP isn’t testing with HHVM anymore (bummer).

    • This reply was modified 8 years, 8 months ago by mattb150.

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘HTTP 500 when adding product to cart after 3.2 update’ is closed to new replies.