-
Notifications
You must be signed in to change notification settings - Fork 55
fix(subscriptions): migrated subscription switch #4335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes subscription switching for migrated subscriptions that lack an initial order. WooCommerce Subscriptions requires the last_order_date_created meta to allow subscription switches, but subscriptions migrated from Piano or Stripe don't have this value.
Key Changes:
- Implements a filter hook to detect migrated subscriptions without a last order date
- Backfills the
last_order_date_createdmeta using the subscription's scheduled start date - Performs validation checks to ensure the subscription can be switched before allowing the operation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
includes/plugins/woocommerce-subscriptions/class-woocommerce-subscriptions.php
Outdated
Show resolved
Hide resolved
includes/plugins/woocommerce-subscriptions/class-woocommerce-subscriptions.php
Outdated
Show resolved
Hide resolved
…ubscriptions.php Co-authored-by: Copilot <[email protected]>
…ubscriptions.php Co-authored-by: Copilot <[email protected]>
## [6.27.1](v6.27.0...v6.27.1) (2025-12-08) ### Bug Fixes * **subscriptions:** migrated subscription switch ([#4335](#4335)) ([4438b9a](4438b9a))
|
🎉 This PR is included in version 6.27.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
NPPM-2434
Migrated subscriptions don't have an initial order, which is required by Woo Subscription to allow switches. This is checked via the
last_order_date_createdmeta.This PR implements a strategy to backfill this meta using the scheduled start date value. This should happen on demand while generating the switch cart.
How to test the changes in this Pull Request:
?upgrade-subscription=1and sign in as the reader_piano_subscription_idor_stripe_subscription_idorder meta with any value to the subscription?upgrade-subscription=1again and confirm you are able to complete the switchOther information: