Currently, if there are multiple renewal orders with the pending payment status, and you set one of them to completed, then one of the other renewal orders is changed to the processing status. This PR fixes that by checking if the order being handled is the last renewal order from the subscription. It also introduces some new helper functions for subscriptions.
How to test this PR
Purchase a subscription product
Use the "Create pending renewal order" subscription action to create 2 or more renewal orders with the pending payment status for the same subscription.
Set any one of the pending payment renewal orders to completed (not the last one)
On trunk, notice that another one of the pending payment renewal orders has been changed to processing
On this branch, that will not happen
Product impact
[x] Added changelog entry (or does not apply)
[x] Will this PR affect WooCommerce Subscriptions? yes
Fixes 4503-gh-woocommerce/woocommerce-subscriptions
Description
Currently, if there are multiple renewal orders with the pending payment status, and you set one of them to completed, then one of the other renewal orders is changed to the processing status. This PR fixes that by checking if the order being handled is the last renewal order from the subscription. It also introduces some new helper functions for subscriptions.
How to test this PR
pending payment
status for the same subscription.pending payment
renewal orders tocompleted
(not the last one)trunk
, notice that another one of thepending payment
renewal orders has been changed toprocessing
Product impact