Fatal error on order cancellation – missing method in Subscription plugin
-
Hello YITH support team,
I’m facing a critical fatal error with YITH WooCommerce Subscription whenever an order is cancelled. When changing the status from Completed to Cancelled, WordPress crashes with the following error:
PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class YWSBS_Subscription_Order does not have a method "cancel_subscriptions" in /wp-includes/class-wp-hook.php on line 326This indicates that your plugin registers the following invalid hook:
add_action('woocommerce_order_status_cancelled', ['YWSBS_Subscription_Order', 'cancel_subscriptions']);
However, the classYWSBS_Subscription_Orderdoes not implement thecancel_subscriptions()method, which causes a TypeError and a complete backend crash during order cancellation.To keep my site stable, I had to create a temporary workaround that removes this faulty hook before execution. The issue is easily reproducible on any WooCommerce order with a subscription product.
Environment:
- WordPress 6.7.1
- WooCommerce (latest)
- YITH WooCommerce Subscription (latest)
- PHP 8.3
- Theme: Themify Builder-based
Expected behavior: cancelling an order should deactivate the related subscription gracefully, without triggering a fatal error.
Please escalate this issue to your development team — it’s a blocking problem under PHP 8+. I can provide admin access or detailed logs if needed.
Thank you,
Frédéric Le Guen
Founder – Excel-Exercice.com
You must be logged in to reply to this topic.