Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
81 stars 29 forks source link

Fixed issue that would turn subscriptions into manual renewals when a payment method got deleted #527

Closed leonardola closed 8 months ago

leonardola commented 8 months ago

Fixes https://github.com/Automattic/woocommerce-payments/issues/7457

Description

This PR fixes a bug that would happen in WooPayments when a card that was being used by a subscription got deleted. This happened because the subscription payment method was updated while the old payment method still existed in cache and in Stripe.

Basically this function executed before this one

There is another PR trying to fix this issue in WooPayments side which is probably better https://github.com/Automattic/woocommerce-payments/pull/7472

How to test this PR

Product impact

james-allan commented 8 months ago

We've got a planned release tomorrow, so merging this now to make sure it gets into the next release of Subscriptions. Thanks again @leonardola.

mattallan commented 8 months ago

I see we've already released this but I'm wondering if we should've gone with the PR in WooPayments instead of this one in Woo Subscriptions because making this change in subscriptions can potentially impact many other gateways that expected our hook to run on 10.

I did a quick search and could only find 2 other gateways in my list of local plugins that use this hook; Stripe hooks on 10 and Square hooks onto priority 25.

I'll dig into whether Stripe is impacted by this change and open an issue if there's a bug.