The following was added in WooCommerce Subscriptions 4.7.0 (from the version history):
Introduce a WC_Subscription::set_status() function to handle subscriptions set with a draft or auto-draft status. Replaces the need for the overriding WC_Subscription::get_status() which has been deleted.
The user in 6170392-zen has custom code on their site where the set_status( method in WC_Subscription always returns null instead of the response from the parent set_status() method from the WC_Order class even though that method is called by the new one.
They'd like WC_Subscription::set_status() to return the same response as WC_Order::set_status() (which is an array), but WC_Subscription::set_status() is returning null.
They resolved this by updating the final line of the new set_status() function to:
The following was added in WooCommerce Subscriptions 4.7.0 (from the version history):
The user in 6170392-zen has custom code on their site where the
set_status(
method inWC_Subscription
always returnsnull
instead of the response from the parentset_status()
method from theWC_Order
class even though that method is called by the new one.They'd like
WC_Subscription::set_status()
to return the same response asWC_Order::set_status()
(which is an array), butWC_Subscription::set_status()
is returningnull
.They resolved this by updating the final line of the new set_status() function to:
https://github.com/Automattic/woocommerce-subscriptions-core/pull/258#pullrequestreview-1183714309 seems to indicate that this might be expected, but it was suggested that an issue be created in p1680552859262189-slack-C7U3Y3VMY and p1680581731084739-slack-C02BW3Z8SHK