-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pre-orders status when UPE is enabled (with a new payment method) #2911
Fix pre-orders status when UPE is enabled (with a new payment method) #2911
Conversation
*/ | ||
public function get_latest_charge_from_intent( $intent ) { | ||
if ( ! empty( $intent->charges->data ) ) { | ||
return end( $intent->charges->data ); | ||
} else { | ||
} elseif ( ! empty( $intent->latest_charge ) ) { |
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.
This just fixes a warning shown at the top of the page for pre-orders, the latest_charge
property does not exist in this case (per my tests). Also, can be nullable per Stripe's documentation.
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.
The latest_charge
issue has been fixed in #2910. Sharing this in case you would like to update this to avoid conflicts later.
Thanks for your work here @wjrosa! Could we please point these changes to the The UPE files we're changing in this PR are heavily updated in that branch. By implementing these changes there directly, we'd save ourselves some potential conflicts and extra testing when updating that branch with the latest |
Hi @a-danae ! Sure, just did it 😄 |
Thanks Wesley! 🙌 |
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.
The fix works as described 🎉
Before this change: status of a pre-order is set as Processing
In this branch:
- Status of a pre-order is set as
Pre-ordered
✔️ - Status of a normal order is set as
processing
✔️
*/ | ||
public function get_latest_charge_from_intent( $intent ) { | ||
if ( ! empty( $intent->charges->data ) ) { | ||
return end( $intent->charges->data ); | ||
} else { | ||
} elseif ( ! empty( $intent->latest_charge ) ) { |
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.
The latest_charge
issue has been fixed in #2910. Sharing this in case you would like to update this to avoid conflicts later.
Fixes #2572
Changes proposed in this Pull Request:
This PR fixes an issue when checking out pre-order products with a new payment method. Currently, there's a bug that puts pre-orders into the
processing
status on this case (the status should remain aspre-ordered
).The fix consists in replicating part of the non-UPE purchase flow and not calling the
process_response
orpayment_complete
for pre-orders.Testing instructions
npm install
,npm build:webpack
andnpm run up
pre-ordered
as expectedchangelog.txt
andreadme.txt
(or does not apply)Post merge