-
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
add currency code to cart and checkout block totals when mccy is enabled #8636
add currency code to cart and checkout block totals when mccy is enabled #8636
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: +109 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
…icit-currency-code
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 tests well! But I ran into something interesting while testing this.
- Make sure WC 8.7 and/or 8.6 are still properly supported ✅
- I tested it on both versions and everything seems to be ok 🎉
- Make sure currency code is displayed when using WC 8.8
⚠️ - I tested with USD and EUR and everything worked as expected, except one thing: while using EUR the formatting of the currency didn't match the shortcode version. Any idea why? This issue also triggered me a thought about whether it'd be feasible to perform this change in the backend rather than in the frontend 🤔
Shortcode version | Blocks version |
---|---|
Thanks for the review @cesarcosta99!
I have no idea why. And the shortcode version is hilariously wrong about the formatting. The correct formatting for EUR is €, definitely not €. There has to be some bug somewhere causing this, but I don't have a clue what it is. I even have my store currency set to USD with the correct USD formatting, so it's not like the store currency formatting is messing with things. I can, however, say with confidence that it's not this PR. The filter I'm using in the blocks expects a string returned with a This definitely warrants an issue though, nice catch! I'll open one 👍
Not to my knowledge, no. AFAICT the Cart and Checkout blocks apply their own formatting based on configurations available in the front-end. They don't receive a formatted amount from the backend 😕 . |
I have just learned that both formats are valid 😮 . So maybe this is a consistency bug, but it's not introduced in this version. I went back to 4d46126 (middle-ish of March this year) and it was still present there. |
…icit-currency-code
@cesarcosta99 FYI I've enabled merge when ready 👍 |
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 have just learned that both formats are valid 😮 . So maybe this is a consistency bug, but it's not introduced in this version
Yeah, I didn't see anything wrong in the code itself as you do <price/> ${ cart.cartTotals.currency_code }
. This issue is somewhat unrelated to your changes, but I still wanted to ask to see if anything popped up.
Thanks for creating an issue for this 💯
Fixes #2648
Changes proposed in this Pull Request
Screenshots
Testing instructions
Note
This feature uses a blocks filter introduced in WC v8.8 which has not yet been released. See testing instructions for details.
Make sure WC 8.7 and/or 8.6 are still properly supported
develop
).develop
).Make sure currency code is displayed when using WC 8.8
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