Skip to content
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

Adding admin notices for detached subscriptions #3863

Merged
merged 9 commits into from
Feb 11, 2025

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Feb 10, 2025

See: p1739145321956079-slack-C7U3Y3VMY

Changes proposed in this Pull Request:

This PR adds new admin notices to alert merchants when subscriptions payment methods are detached, preventing renewals from happening. This should help them be more proactive in identifying and fixing this kind of issue.

Testing instructions

  • Checkout and build this branch on your test environment (add/admin-notices-for-detached-subscriptions)
  • Connect your Stripe account
  • Install the subscriptions extension
  • Create a subscription product
  • As a shopper, purchase the subscription
  • As a merchant, access the Stripe dashboard and delete the payment methods bound to the shopper account above
  • Confirm that you can see the new notice in wp-admin:
Screenshot 2025-02-11 at 13 27 39

(you can also just set $payment_method->customer to null in the subscriptions_check_environment method)


  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@wjrosa wjrosa self-assigned this Feb 10, 2025
@wjrosa wjrosa marked this pull request as ready for review February 11, 2025 16:23
@@ -58,6 +65,11 @@ public function admin_notices() {
// All other payment methods.
$this->payment_methods_check_environment();

// Subscription related checks.
if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscription' ) && version_compare( WC_Subscriptions::$version, '2.2.0', '>=' ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved a helper method with this check here so we can use it in non-gateway classes.

@wjrosa wjrosa requested a review from diegocurbelo February 11, 2025 18:05
Copy link
Member

@diegocurbelo diegocurbelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this so quickly @wjrosa 👏🏼

The code looks good, and it tests well 🚢

@wjrosa wjrosa enabled auto-merge (squash) February 11, 2025 21:46
@wjrosa wjrosa merged commit ecae5a8 into develop Feb 11, 2025
37 checks passed
@wjrosa wjrosa deleted the add/admin-notices-for-detached-subscriptions branch February 11, 2025 21:53
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.

2 participants