This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Fix free trial subscriptions orders missing payment method meta #4854
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ricardo
commented
Sep 28, 2021
@@ -461,7 +461,7 @@ private function update_customer_from_request( \WP_REST_Request $request ) { | |||
*/ | |||
private function update_order_from_request( \WP_REST_Request $request ) { | |||
$this->order->set_customer_note( $request['customer_note'] ?? '' ); | |||
$this->order->set_payment_method( $this->order->needs_payment() ? $this->get_request_payment_method( $request ) : '' ); | |||
$this->order->set_payment_method( $this->get_request_payment_method( $request ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I just thought I should keep the diff small as I'm not familiar with the codebase, but apparently the function get_request_payment_method
is only being used here.
We could perhaps replace it for get_request_payment_method_id
and remove the other one.
Size Change: 0 B Total Size: 1.23 MB ℹ️ View Unchanged
|
tjcafferkey
approved these changes
Sep 28, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github-actions
bot
added
status: ready to merge
and removed
status: needs review
labels
Sep 28, 2021
3 tasks
senadir
added a commit
that referenced
this pull request
Oct 26, 2021
jonny-bull
pushed a commit
to jonny-bull/woocommerce-gutenberg-products-block
that referenced
this pull request
Dec 14, 2021
* Revert "Fix free orders missing payment method (woocommerce#4854)" This reverts commit 90e513b. * use Cart needs payment instead of Order needs payment * switch to nullish coalescing * remove extra line
jonny-bull
pushed a commit
to jonny-bull/woocommerce-gutenberg-products-block
that referenced
this pull request
Dec 16, 2021
* Revert "Fix free orders missing payment method (woocommerce#4854)" This reverts commit 90e513b. * use Cart needs payment instead of Order needs payment * switch to nullish coalescing * remove extra line
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4853
Issue in Stripe: woocommerce/woocommerce-gateway-stripe#1964
When debugging the issue above in the Stripe plugin, I found that free trial subscriptions purchased via the blocks checkout didn't have the payment method post meta. This caused free trial subscriptions to always require manual renewals after the trial period ended.
This is possibly affecting pre-orders and other types of off-session based orders, although I only tested the issue with the subscriptions extension.
I reproduced the issue in Stripe and WooCommerce Payments, but this is probably happening in all payment gateways that support free trial subscriptions.
Apparently when the code got refactored, it wasn't refactored into its equivalent previous functionality, so it led to the inconsistency mentioned above.
Screenshots
Before: Payment method didn't get saved and required manual renewals
After: Payment method gets saved and supports automatic renewals
Testing
Automated Tests
Manual Testing
How to test the changes in this Pull Request:
4242424242424242
and any valid CVC and expiration date.Performance Impact
Changelog