This is a workaround and fix for the following situation which occurs in recent versions (<3.0.12) of WooCommerce Subscriptions. When purchasing a subscription which is limited to “any” (ie a user can only have one subscription of any status), the user cannot pay for a failed order as the subscription product gets removed from their basket.
If the order is an initial purchase where the payment for the parent order for a subscription has failed, the user or support team can work around this by setting the order status to cancelled which will allow the user to purchase the product again. If the order is a resubscribe, cancelling the resubscribe order with the failed payment does not work.
Reproduce
To reproduce the parent order issue:
- Create an order with a failed status containing a subscription product which is limited to one of any status per user.
- In the account pages of the user whose order it is, try to pay for that order. This will fail.
- Cancel the order and try to purchase a new one. This will succeed.
To reproduce the resubscribe issues:
- On a subscription which has been cancelled and to which the user can resubscribe, create a resubscribe order and set the order status to failed.
- In the account pages of the user whose order it is, try to pay for that order. This will fail.
- Cancel the order. There is now no way to resubscribe to the subscription.
Fixes
There are two fixes necessary for this. For the issue where failed payments remove the subscription from the cart when payment is attempted again, this patch fixes it and will be included in WooCommerce Subscriptions 3.0.13 (or whatever is after 3.0.12!). (Note to self: is there a diff highlighter in Prism? Add it if so.)