Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter butchewing

    (@butchewing)

    I have added a possible fix by removing woocommerce_refunds and wc_order_refunds from the cache groups in Object cache pro.

    https://objectcache.pro/docs/ignoring-groups

       'non_persistent_groups' => [
    'woocommerce_refunds',
    'woocommerce_orders',
    'woocommerce_order_items',
    'woocommerce_order_data',
    'wc_order_meta',
    'wc_order_refunds',
    'woocommerce',
    'wc_refund',
    ],
    Thread Starter butchewing

    (@butchewing)

    You’re not going to believe this. I’m 99.99% sure that the issue is Object Cache. When disabled, refunds do not generate errors. When enabled, refunds throw an error. With that being the case, is this something that needs to be corrected in the Stripe plugin itself?

    When WooCommerce calls get_qty_refunded_for_item(), it expects each refund returned by get_refunds() to be a WC_Order_Refund object (or at least an object with a get_items() method). However, because of Object Cache Pro, the cached refunds data is sometimes an int (or null), not an object. This leads to a fatal error when the code directly calls get_items() on what turns out to be an int.

    Here’s a more technical breakdown:

    1. The WC_Order::get_refunds() method uses wp_cache_get() to attempt to retrieve a cached refunds array. Object Cache Pro is used to speed up repeated queries.
    2. If the cache returns data in an unexpected format (for example an integer or incomplete data structure), then iterating over that data results in a variable that isn’t a WC_Order_Refund.
    3. The method get_qty_refunded_for_item() iterates over what it assumes are refund objects:
      • It calls get_items() on each refund.
      • If the refund isn’t an object (because of cache corruption or misformatting), PHP throws a fatal error when trying to call a method on a non-object (an int).
    4. The underlying issue appears to be that Object Cache Pro isn’t returning data in the expected format—possibly due to caching an int (like an ID placeholder or an error code) instead of a full refund object.
    5. A temporary workaround is to add a defensive check (using is_object() and method_exists()) before calling get_items(), which avoids the fatal error by skipping any refund that isn’t in the proper object format. However, the root cause is in the caching layer, so a long-term solution should address how Object Cache Pro caches or retrieves this data.

    This explanation highlights why the error occurs and how the caching plugin’s behavior disrupts the expected data structure for WooCommerce refunds.

    • This reply was modified 12 months ago by butchewing.
    Thread Starter butchewing

    (@butchewing)

    Sorry, nothing resolved on my end yet. It is still happening when a refund is generated. I plan to move to staging and deactivate all plugins and go through them one by one. I’m not in a big hurry as there are WAY too many plugins on this site. I was kind of hoping that a resolution would come before I had to actually go through that exercise. But, now that @nayembwip is also having the issue, I have more of an impetus to do it.

    Thread Starter butchewing

    (@butchewing)

    Ha! I suppose that I need http://festplugins.com/woocommerce-stripe-ach-gateway/. Thanks for your help! I am very curious to know how you manage products, stock, shipping, and taxes outside of WooCommerce. It seems like this plugin is great for non-profit donations, but I’m not sure how to get it to work in an e-commerce setting.

    Thread Starter butchewing

    (@butchewing)

    Oh. How do you keep track of the customers that have purchased a product outside of WooCoomerce?

    Thread Starter butchewing

    (@butchewing)

    Here is a test URL https://woocommerce-219633-984712.cloudwaysapps.com/product/test/. You can see that once you click the ‘Buy Now’ button, you are redirected to the checkout. In the checkout, the error message is displayed in the browser console. The amount is prepopulated with Javascript. The ‘Select Bank Account’ button is inoperative.

    I discovered that you can not use do_shortcode( '[clean-login-register]' );. The registration form will be displayed, but you will not be able to register or get any validation notifications.

    @fhundewadt that is very cool! Do we need both clean-login and clean-login-ex installed?

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