-
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
MCCY: Round to lowest denomination before applying price rounding from MCCY settings #9932
MCCY: Round to lowest denomination before applying price rounding from MCCY settings #9932
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: 0 B Total Size: 1.34 MB ℹ️ View Unchanged
|
…ings This is consistent with the results of the discussions in paJDYF-g0K-p2. Previous behavior as of #9876 is to ceil the price before applying any rounding options from the settings, but based on the P2 discussions we identified that using `round` instead of `ceil` is the better approach.
d971558
to
ff38f59
Compare
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 tested very well and matched all the expectations. I included a table of the scenarios I tested below to cover product types, quantities, price rounding, and price charming settings. The only note I had was that with JPY, since the price rounding options only goes to 1 (not 0) it essentially always uses a ceiling. I believe this is the desired behavior given the zero decimal aspect, but wanted to confirm that with you.
EUR using a conversion rate of 3.783325
Product Type | Price | Single Item Conversion | Quantity | Quantity Conversion | Using Round | Rounding 0.5, Charm None | Rounding None, Charm -0.01 | Rounding 1.0, Charm -0.01 |
---|---|---|---|---|---|---|---|---|
Deposit | 25 | 94.583125 | 1 | 94.583125 | 94.58 | 95 | 94.57 | 94.99 |
Subscription | 10 | 37.83325 | 1 | 37.83325 | 37.83 | 38 | 37.82 | 37.99 |
Subscription Sign Up Fee | 2 | 7.56665 | 1 | 7.56665 | 7.57 | 8 | 7.56 | 7.99 |
Simple Product | 18.5 | 69.9915125 | 1 | 69.9915125 | 69.99 | 70 | 69.98 | 69.99 |
Simple Product | 18.3 | 69.2348475 | 1 | 69.2348475 | 69.23 | 69.5 | 69.22 | 69.99 |
Deposit | 25 | 94.583125 | 20 | 1891.6625 | 1891.6 | 1900 | 1891.4 | 1899.8 |
Subscription | 10 | 37.83325 | 20 | 756.665 | 756.6 | 760 | 756.4 | 759.8 |
Subscription Sign Up Fee | 2 | 7.56665 | 20 | 151.333 | 151.4 | 160 | 151.2 | 159.8 |
Simple Product | 18.5 | 69.9915125 | 20 | 1399.83025 | 1399.8 | 1400 | 1399.6 | 1399.8 |
Simple Product | 18.3 | 69.2348475 | 20 | 1384.69695 | 1384.6 | 1390 | 1384.4 | 1399.8 |
JPY using a conversion rate of 147.37782
Product Type | Price | Single Item Conversion | Using Ceil | Rounding 50, Charm None | Rounding 1, Charm -1 | Rounding 100, Charm -1 |
---|---|---|---|---|---|---|
Deposit | 25 | 3684.4455 | 3685 | 3700 | 3684 | 3699 |
Subscription | 10 | 1473.7782 | 1474 | 1500 | 1473 | 1499 |
Subscription Sign Up Fee | 2 | 294.75564 | 295 | 300 | 294 | 299 |
Simple Product | 18.5 | 2726.48967 | 2727 | 2750 | 2726 | 2799 |
Simple Product | 18.3 | 2697.014106 | 2698 | 2700 | 2697 | 2699 |
I had one minor nit on reusing a value, but it's not a blocker in my opinion. Otherwise this all looks good to me!
…before-applying-rounding-from-settings
@bborman22, yes that is expected behavior if the rounding is set to |
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 gave this another quick run through after that update and everything still looked good!
LGTM!
Fixes #10009
Changes proposed in this Pull Request
This is consistent with the results of the discussions in paJDYF-g0K-p2.
Previous behavior as of #9876 is to ceil the price before applying any rounding options from the settings, but based on the P2 discussions we identified that using
round
instead ofceil
is the better approach.Testing instructions
Then;
Note
You must have the WooCommerce Deposits plugin active and enabled.
3.783325
.none
and "price rounding" to0.00
.94.58
94.58
.Finally;
EUR
andJPY
, and make sure rounding is consistently applied.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