-
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
Add total tax amount to metadata #3726
Merged
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
hsingyuc
commented
Jan 15, 2025
@@ -1769,6 +1769,7 @@ public function get_metadata_from_order( $order ) { | |||
'order_key' => $order->get_order_key(), | |||
'payment_type' => $payment_type, | |||
'signature' => $this->get_order_signature( $order ), | |||
'tax_amount' => WC_Stripe_Helper::get_stripe_amount( $order->get_total_tax(), strtolower( $order->get_currency() ) ), |
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.
I've considered naming it total_tax
, but since we use shipping_amount
, I opted for tax_amount
here.
diegocurbelo
approved these changes
Jan 16, 2025
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.
Code looks good, and it tests well 🚢
* Lint fixes --------- Co-authored-by: nbloomf <nathan.bloomfield@automattic.com> Co-authored-by: Anne Mirasol <anne.mirasol@automattic.com>
* Fix duplicate emails when enabling the gateway During payment gateway initialization, WC core adds hooks that will get triggered when the main gateway is enabled. Using a centralized option_key for all 'child gateways' makes WC core issue separate email notifications for all of them. To sidestep this problem, with this change, we use separate option_id for each child gateway but still use the parent gateway settings when retrieving them. Changes made: - Update get_option_key() to return settings specific to the Stripe ID. - Introduce get_option() method to fetch options from the main Stripe gateway. --------- Co-authored-by: Mayisha <33387139+Mayisha@users.noreply.github.com>
Co-authored-by: Diego Curbelo <diego@curbelo.com>
d43a20f
to
d194aa2
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #2103
Changes proposed in this Pull Request:
This PR adds the total tax amount to metadata because we only pass the order total to Stripe but not tax information.


I also considered adding individual product tax information in the Level 3 data and add into metadata, because here says we support sales tax in level 2 but I don't see it. I also learned that Stripe supports Level 3 data in their API on both
Charge
andPaymentIntent
but gated, so I removed it.Testing instructions
tax_amount
under metadata.changelog.txt
andreadme.txt
(or does not apply)Post merge