Skip to content
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

Update symbol and formatting of the XPF currency #46960

Merged
merged 9 commits into from May 14, 2024

Conversation

cesarcosta99
Copy link
Contributor

@cesarcosta99 cesarcosta99 commented Apr 26, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes Automattic/woocommerce-payments#5150.

The issue above suggests that we need to change how the XPF currency is formatted. Currently, the currency is displayed like 1 234 Fr. The suggestion is to change it to XPF 1,234. I did some investigation by looking up places online where I could see how they were presenting their currency and my conclusion is that we may want to adopt the suggestion as a default option, but not for the specific locales that use it.

In French Polynesia

It's clear that the XPF symbol is predominant. The formatting varies a bit, but most places seem to use 123 456 XPF.

Examples
image image image
image image

In New Caledonia

The symbol used was more split in this one, but the preferred options still seems to be XPF. The formatting was more consistent, being 123 456 XPF the most used.

Examples
image image image
image image

In Wallis and Futuna

For this country I couldn't find examples of how they use the XPF currency. Therefore, I think it's safe to assume it's similar to the aforementioned countries until someone proves otherwise.

Conclusion

By navigating through some stores of these countries and seeing the examples, we can confirm that XPF is widely adopted. We still see some variations like Fr, F and FCFP, but since these countries usually offer more than one currency, XPF is more known and used among the options.

To sum up the changes in this PR:

  • I replaced the currency symbol from Fr to XPF.
  • I replaced the decimal separator from , to .. I did this because XPF doesn't have decimals, and if we're ever going to use comma, it's going to be in the thousand separator.
  • I kept the XPF formatting for the specific locales, but changed the default one that's going to be applied for the rest of the world. With this change, the currency is going to be formatted like XPF 1,234.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

Pre-requisites

  1. Set up WooPayments on a new site (you can use an existing setup).
  2. As a merchant, navigate to Payments > Settings.
  3. In the Advanced settings section, enable multi-currency, if needed.
  4. Checkout to this branch and generate a build: pnpm --filter='@woocommerce/plugin-woocommerce' build:zip.
  5. Install the WooCommerce build on the site.
    5.1. If you installed it in an existing site, you will need to clear up the following transients from the wp_options table. That way we ensure we have the most up-to-date locale and currency information on WooPayments.
    - _transient_wcpay_currency_format
    - _transient_wcpay_locale_info

Test: XPF currency is formatted correctly in the currency preview

  1. As a merchant, navigate to WooCommerce > Settings > Multi-currency.
  2. Make sure the currency switcher option is enabled, or set up a currency switcher widget. That will be necessary for the next tests.
  3. Add the XPF currency, if needed.
  4. Click on the manage link for the XPF currency.
  5. In the Preview section, the CFP franc value should be formatted like XPF1,234.

Test: XPF currency is formatted correctly in the shortcode cart/checkout

  1. As a shopper, navigate to the store and add a product to the cart.
  2. Navigate to the shortcode cart and checkout pages.
  3. In each one, the total value should be formatted like XPF 1,234. Note there's a space between the symbol and the number.

Test: XPF currency is formatted correctly in the cart/checkout Blocks

  1. As a shopper, navigate to the store and add a product to the cart.
  2. Navigate to the Blocks cart and checkout pages.
  3. In each one, the total value should be formatted like XPF1,234 XPF.

Note

The fact that the total value is formatted differently in Blocks is a Blocks issue (Automattic/woocommerce-payments#8651). I left a comment flagging the same behavior for XPF here: Automattic/woocommerce-payments#8651 (comment).

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@cesarcosta99 cesarcosta99 added type: refactor The issue/PR is related to refactoring. focus: currency Issues related to currencies. plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Apr 26, 2024
@cesarcosta99 cesarcosta99 self-assigned this Apr 26, 2024
@cesarcosta99 cesarcosta99 changed the title Update symbol and some details of the XPF currency Update symbol and formatting of the XPF currency Apr 26, 2024
@cesarcosta99 cesarcosta99 marked this pull request as ready for review April 30, 2024 21:57
@cesarcosta99
Copy link
Contributor Author

@rafaelzaleski, requesting your review here as this is tied to Automattic/woocommerce-payments#8722.

Copy link
Contributor

github-actions bot commented Apr 30, 2024

Hi @rafaelzaleski, @vedanshujain,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link

@rafaelzaleski rafaelzaleski left a 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 all tests have passed as described.

However, I've noticed some failed checks in the CI. Could you address these issues? For instance, in this file, you'll need to include the changes to the XPF currency for the tests.

@github-actions github-actions bot added the focus: api tests Issues related to API tests. label May 2, 2024
@cesarcosta99
Copy link
Contributor Author

Sorry I missed that, @rafaelzaleski. I fixed it in 9e5e3e3.

The CI was flagging some linting issues after my fix. I tried to fix them in 51abcf4, but ended up reverting it in f531016 because the issues persisted. I don't really want to enter in a rabbit hole trying to fix these issues that are unrelated to the changes in this PR, so I'm asking for another review.

@cesarcosta99
Copy link
Contributor Author

@rafaelzaleski, I was able to run the linting command locally and caught all the issues. Fix is in 08ae665.

Also requesting a review from Proton as we're touching core files.

@cesarcosta99 cesarcosta99 requested review from a team and vedanshujain and removed request for a team May 2, 2024 23:20
Copy link

@rafaelzaleski rafaelzaleski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@vedanshujain vedanshujain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I tested by switching currency to XPF and checked various flows on the shop instead of enabling multi-currency.

For this:

The fact that the total value is formatted differently in Blocks is a Blocks issue (Automattic/woocommerce-payments#8651). I left a comment flagging the same behavior for XPF here: Automattic/woocommerce-payments#8651 (comment).

Is there an open issue in the blocks somewhere? If so, does that needs to be fixed before we merge this PR?

@cesarcosta99
Copy link
Contributor Author

Is there an open issue in the blocks somewhere? If so, does that needs to be fixed before we merge this PR?

Since multi-currency is a feature of WooPayments, that is being tracked in Automattic/woocommerce-payments#8651 and we'll handled it within the WooPayments scope. I don't think this blocks this PR once the impact is pretty low.

@naman03malhotra naman03malhotra merged commit f5e45ef into trunk May 14, 2024
27 checks passed
@naman03malhotra naman03malhotra deleted the fix/5150-xpf-currency branch May 14, 2024 21:50
@github-actions github-actions bot added this to the 9.0.0 milestone May 14, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label May 14, 2024
@rodelgc rodelgc added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: api tests Issues related to API tests. focus: currency Issues related to currencies. needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris type: refactor The issue/PR is related to refactoring.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-decimal currency and XPF multi-currency bugs
5 participants