Skip to content

Change default subscription renewal pre-notification window from 7 to 14 days#259

Open
rvdsteege with Copilot wants to merge 13 commits into
mainfrom
copilot/change-default-pre-notification-period
Open

Change default subscription renewal pre-notification window from 7 to 14 days#259
rvdsteege with Copilot wants to merge 13 commits into
mainfrom
copilot/change-default-pre-notification-period

Conversation

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Default pre-notification was effectively one week before renewal, which is too short for SEPA Direct Debit flows where 14-day notice is commonly required unless otherwise agreed. This updates the default scheduling and suppression logic to a 14-day window while preserving compatibility with existing stored metadata.

  • Scheduling window updated to 14 days

    • get_subscriptions_wp_query_that_require_notification() now targets renewals in +2 weeks (instead of +1 week).
  • Duplicate-notification suppression aligned to 14 days

    • meets_notification_requirements() now suppresses re-sends if a notification exists within the last 2 weeks (instead of 1 week).
  • Metadata key migration with backward compatibility

    • New primary key: notification_date_2_weeks.
    • Read path falls back to notification_date_renewal, then legacy notification_date_1_week when needed.
  • Focused test coverage expanded

    • Added coverage for suppression within the 14-day window using:
      • the new key (notification_date_2_weeks)
      • the migration fallback key (notification_date_renewal)
      • the legacy key fallback (notification_date_1_week)
  • Changelog

    • Added an Unreleased note documenting the default change to 14 days.
$start_date = new \DateTimeImmutable( 'midnight +2 weeks', new \DateTimeZone( 'GMT' ) );
$end_date   = new \DateTimeImmutable( 'tomorrow +2 weeks', new \DateTimeZone( 'GMT' ) );

$notification_date_string = $subscription->get_meta( 'notification_date_2_weeks' );

if ( null === $notification_date_string || '' === $notification_date_string ) {
	$notification_date_string = $subscription->get_meta( 'notification_date_renewal' );
}

if ( null === $notification_date_string || '' === $notification_date_string ) {
	$notification_date_string = $subscription->get_meta( 'notification_date_1_week' );
}

Copilot AI changed the title [WIP] Change default subscription pre-notification period to 14 days Change default subscription renewal pre-notification window from 7 to 14 days Jun 29, 2026
Copilot AI requested a review from rvdsteege June 29, 2026 08:48
@rvdsteege

Copy link
Copy Markdown
Member

@copilot use notification_date_2_weeks as new meta key instead of notification_date_renewal.

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot use notification_date_2_weeks as new meta key instead of notification_date_renewal.

Updated in commit b81b20b: the new primary meta key is now notification_date_2_weeks (write path and tests), with backward-compatible reads retained for notification_date_renewal and notification_date_1_week.

@rvdsteege rvdsteege marked this pull request as ready for review June 29, 2026 09:39
@rvdsteege rvdsteege requested a review from remcotolsma June 29, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change default subscription pre-notification period from 7 to 14 days

2 participants