If you update your default payment method on the My Account → Payment methods screen and the Payment method doesn't integrate with the woocommerce_subscription_payment_meta filter (eg WooPayments), then additional meta will be added to the subscription without a key.
Notice the final row of the has an empty meta key
This was caused by the foreach loop I've changed in this PR. If the loop didn't find a meta key used for tokens, it would just set it to an empty key because that's the default.
This PR fixes that.
How to test this PR
Install WooPayments
Install Woo Subscriptions
Create 2 subscription products with different billing frequencies (weekly and monthly).
Purchase the products together using a standard card 4242424242424242.
Make another purchase using a different card eg 4000056655665556.
Go to My Account → Payment methods
Change the 4000056655665556 payment method to your default.
In the notice that appears on the next page, click "Yes".
On trunk, check the order meta table for your subscription and you should notice there is an empty meta key with the token ID stored.
On this branch, make another subscription purchase using a new card, repeat steps 6-8 no empty additional meta key should be stored.
Fixes https://github.com/woocommerce/woocommerce-subscriptions/issues/4631
Description
If you update your default payment method on the My Account → Payment methods screen and the Payment method doesn't integrate with the
woocommerce_subscription_payment_meta
filter (eg WooPayments), then additional meta will be added to the subscription without a key.Notice the final row of the has an empty meta key
This was caused by the foreach loop I've changed in this PR. If the loop didn't find a meta key used for tokens, it would just set it to an empty key because that's the default.
This PR fixes that.
How to test this PR
4242424242424242
.4000056655665556
.4000056655665556
payment method to your default.trunk
, check the order meta table for your subscription and you should notice there is an empty meta key with the token ID stored.Zip of this branch for convenience: woocommerce-subscriptions-core.zip
trunk
Product impact