Skip to content

Conversation

@CacheMeOwside
Copy link
Contributor

@CacheMeOwside CacheMeOwside commented Jul 11, 2022

All Submissions:

Changes proposed in this Pull Request:

This PR fixes the incorrect count of order numbers displayed in the 'Order status changed' and 'Removed personal data' notices after bulk editing a large number of orders ( > 999 ).

The problem lies in this line of code :

sprintf( _n( '%s order status changed.', '%d order statuses changed.', $number, 'woocommerce' ), number_format_i18n( $number ) )

So, if $number is 1000, number_format_i18n() converts it into string '1,000' which sprintf() renders as '1' due to the specifier %d, which treats the resultant string ('1,000') as an integer and renders it as a (signed) decimal number.
I have replaced the %d with %s for both 'Order status changed' and 'Removed personal data' notices.

With this fix, the order count will reflect correctly in the notice :

33253-order-count-fix

Closes #33253

How to test the changes in this Pull Request:

  1. Setup a WooCommerce store with one product
  2. Go to the Orders page with this link:
    /wp-admin/edit.php?post_type=shop_order&paged=1&bulk_action=marked_completed&changed=9999
  3. Check the notice message

OR

  1. Setup a WooCommerce store with one product
  2. Make a large number of orders (at least 9999)
  3. Mark all orders as "completed"
  4. Check the notice message

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file for each project being changed, ie pnpm changelog add --filter=<project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jul 11, 2022
@barryhughes barryhughes self-requested a review July 29, 2022 20:52
@barryhughes barryhughes merged commit a9b0542 into woocommerce:trunk Aug 2, 2022
@github-actions github-actions bot added this to the 6.9.0 milestone Aug 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2022

Hi @barryhughes, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The number from the "Order status changed" notice gets stripped down

2 participants