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

Commit d09267b

Browse files
authored
Move to next year when 12 months are added to first payment date (#651)
1 parent de943f2 commit d09267b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
*** WooCommerce Subscriptions Core Changelog ***
22

3+
= 7.4.1 - 2024-xx-xx =
4+
* Fix - Add a year to the next renewal date billing interval is 12 months or more for a synced subscription.
5+
36
= 7.4.0 - 2024-08-16 =
47
* Dev - Introduce new parameter to WC_Subscription::get_last_order() to enable filtering out orders with specific statuses.
58
* Update - Schedule subscription-related events with a priority of 1 to allow for earlier execution within the Action Scheduler.

includes/class-wc-subscriptions-synchroniser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,9 @@ public static function calculate_first_payment_date( $product, $type = 'mysql',
686686
$month_number = gmdate( 'm', wcs_add_months( $from_timestamp, $interval ) );
687687
}
688688
}
689+
689690
// when a certain number of months are added and the first payment date moves to next year
690-
if ( $month_number < gmdate( 'm', $from_timestamp ) ) {
691+
if ( $month_number < gmdate( 'm', $from_timestamp ) || $interval >= 12 ) {
691692
$year = gmdate( 'Y', $from_timestamp );
692693
$year++;
693694
$first_payment_timestamp = wcs_strtotime_dark_knight( "{$payment_day} {$month} {$year}", $from_timestamp );

0 commit comments

Comments
 (0)