-
Notifications
You must be signed in to change notification settings - Fork 69
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 FedEx shipping multi-currency rates #9985
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: +243 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
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.
✅ Test: Ensure shipping rates are the same in different currencies
✅ Regression test: insurance remains for higher-ticket products when paying with USD
@ricardo, I don’t understand the logic behind removing insurance based on the currency the customer is using to pay. The underlying value of the item remains the same regardless of the currency, so insurance should be applied based on the item value, not the payment currency.
Isn’t there a way to fix this by sending the USD value to FedEx for insurance, regardless of the payment currency?
I also can't tell with 100% certainty, but when I looked at the code from 10 years ago it seemed like a FedEx-specific logic for US and Canada.
This approach is probably better. I made the change in 568f048 – can you help test it and make sure it doesn't produce any regressions? I'm doing the same. One thing I noticed is that when I change the product price to 500 or 1000 USD it sometimes doesn't calculate the shipping rates and I'm not sure if this is a bug or a problem on my end. |
@rafaelzaleski one key difference with this new approach is that we're still adding insurance to the shipping rates if the store currency is USD and the base address is US, but it will be consistent with other currencies and not only apply to JPY like before this PR. |
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 code looks good and tests well. Great job!
Please update the PR description so that anyone referring to it in the future won't need to read through the comments.
Fixes #10022
Changes proposed in this Pull Request
Originally, we had discovered the inconsistency with shipping rates only happened with JPY. It turns out it wasn't because JPY is a zero decimal currency, but because of the value after conversion.
The MCCY compatibility works by changing the WooCommerce store currency on the fly, but the FedEx API gets the converted values of the product in absolute terms, so if it surpasses a certain threshold, it applies insurance to it.
The way we pass the actual store currency in
set_settings
, but with the price already converted, makes it so that the FedEx API adds insurance to the shipping rates.To avoid this problem, we're now preventing the price from being converted so that the calculations can be made correctly.
Testing instructions
Follow instructions to set up the Woo FedEx shipping extension: #3131
Test: Ensure shipping rates are the same in different currencies
San Francisco / CA / 94110
.Regression test: insurance remains for higher-ticket products when paying with USD
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge