strangerstudios / paid-memberships-pro

The Trusted Membership Platform That Grows with You: Restrict access to content and charge recurring subscriptions using Stripe, PayPal, and more. Fully open source. 100% GPL.
https://www.paidmembershipspro.com
Other
468 stars 360 forks source link

Next Payment Date incorrectly calculated if level has custom trial period. #3130

Open ipokkel opened 2 months ago

ipokkel commented 2 months ago

Describe the bug When setting a custom trial period at $0 for a level, e.g. $0 for the first 2 subscription payments, and a user cancels the level early during the trial period their level is given back with an incorrect expiration date.

To Reproduce Steps to reproduce the behavior:

  1. Go to Memberships > Settings > Levels and create a new level with an initial payment, e.g. $150, and a recurring billing amount, e.g. $10 per 1 Month(s), check Custom Trial, and set the trial billing amount to $0 for the first 2 (or more) subscription payments, and save the level.
  2. Navigate to the frontend Membership Levels page, select this level, and check out.
  3. From the Membership Account page click on the "Cancel" link for this level.
  4. See the incorrect date in the warning notification displayed before canceling.
  5. Cancel membership account.
  6. See the incorrect date set as expiration date.

Screenshots 2024-08-28_09-00-10

2024-08-28_08-52-18

Expected behavior If the user is in a free Custom Trial period to calculate the expiration date to the next payment date as set at the gateway

Isolating the problem (mark completed items with an [x]):

WordPress Environment

Paid Memberships Pro 3.1.3
ipokkel commented 2 months ago

When setting the trial period using the Subscription Delays Add On and specifying the amount of days works perfectly for getting the correct next payment date and can be used as an alternative to a Custom Trial period at $0.

Note: Making this change to level settings will not apply retroactively and applies only to new checkouts after the change is made.