Skip to content

Commit

Permalink
fix: allow set-next-payment-dates-for-migrated-subscriptions to reset…
Browse files Browse the repository at this point in the history
… past dates (#2644)
  • Loading branch information
dkoo authored Sep 21, 2023
1 parent 29d538e commit 72f147e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/reader-revenue/stripe/class-stripe-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,10 @@ public static function set_next_payment_dates_for_migrated_subscriptions( $args,

// Get the next payment date.
$next_payment_date = $subscription->get_date( 'next_payment' );
$is_in_past = $next_payment_date && strtotime( $next_payment_date ) < time();

// If there's no next payment, set it.
if ( ! $next_payment_date ) {
if ( ! $next_payment_date || $is_in_past ) {
$next_payment_date = $subscription->calculate_date( 'next_payment' );
\WP_CLI::log( sprintf( 'No next payment date set. Setting to %s.', $next_payment_date ) );

Expand Down

0 comments on commit 72f147e

Please sign in to comment.