Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Fix get related order IDs method #624

Merged
merged 6 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*** WooCommerce Subscriptions Core Changelog ***

= 7.1.2 - xxxx-xx-xx =
* Fix - Add check to prevent fatal error when retrieving related order IDs.

= 7.1.1 - 2024-05-09 =
* Fix - Resolved an issue that caused "WC_DateTime could not be converted to int" warnings to occur on non-hpos sites while editing a subscription.

Expand Down
5 changes: 4 additions & 1 deletion includes/class-wc-subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,10 @@ protected function get_related_order_ids( $order_type = 'any' ) {
$relation_types = ( 'any' === $order_type ) ? array( 'renewal', 'resubscribe', 'switch' ) : array( $order_type );

foreach ( $relation_types as $relation_type ) {
$related_order_ids = array_merge( $related_order_ids, WCS_Related_Order_Store::instance()->get_related_order_ids( $this, $relation_type ) );
$related_orders_for_relation_type = WCS_Related_Order_Store::instance()->get_related_order_ids( $this, $relation_type );
if ( is_array( $related_orders_for_relation_type ) ) {
$related_order_ids = array_merge( $related_order_ids, $related_orders_for_relation_type );
}
}
}

Expand Down