-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Update summary title to "Discount" instead of coupon(s) and ensure negative fees are reflected in order details #62454
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 summary title to "Discount" instead of coupon(s) and ensure negative fees are reflected in order details #62454
Conversation
7a5d309 to
9418513
Compare
Testing GuidelinesHi @straku , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
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.
🤖 Backwards Compatibility Review - Found 2 potential issues
Generated by Claude via this workflow run
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
Show resolved
Hide resolved
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
Show resolved
Hide resolved
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughThis PR fixes the handling of discount fees in WooCommerce orders. The admin order view label is changed from "Coupon(s):" to "Discount:", the fee display logic is updated to handle negative fees using an absolute value comparison, and new unit tests are added to verify negative fee calculations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
plugins/woocommerce/changelog/2025-12-15-17-18-50-141498 (1)
1-4: Clarify the changelog message for accuracy.The message states fees are "included in the order subtotal calculation," but the actual fix is about display, not calculation. The
get_total_fees()method already correctly sums negative fees—the issue was that the admin UI condition0 < $order->get_total_fees()prevented negative fees from rendering.Consider revising to:
-Ensure discount fees are included in the order subtotal calculation on the admin order view +Ensure negative fees are displayed in the order totals on the admin order view
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
plugins/woocommerce/changelog/2025-12-15-17-18-50-141498(1 hunks)plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php(1 hunks)plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js(2 hunks)plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{php,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/avoid-regex.mdc)
**/*.{php,js,jsx,ts,tsx}: Avoid regular expressions in favor of more readable and maintainable alternatives, only using regex when no built-in alternative exists, performance is critical, the pattern is complex and well-documented, or maintaining legacy code
Document regular expressions extensively by explaining what the pattern matches, using named groups to improve readability, and adding comprehensive tests for edge cases and security issues
Validate regex input first and consider security implications such as ReDoS (Regular Expression Denial of Service) attacks and injection vulnerabilities when using regular expressions
Files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.phpplugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.jsplugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
**/*.{php,js,jsx,tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/code-quality.mdc)
**/*.{php,js,jsx,tsx,ts}: Guard all code against unexpected inputs
Sanitize and validate any potentially dangerous inputs
Ensure code is backwards compatible
Ensure code is readable and intuitive
Add unit or E2E tests where applicable
Files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.phpplugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.jsplugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
plugins/woocommerce/tests/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/woo-phpunit.mdc)
plugins/woocommerce/tests/**/*.php: All setUp() and tearDown() methods in WooCommerce PHPUnit test classes must be declared aspublic, notprotected
All test methods in WooCommerce PHPUnit tests must be declared aspublic, notprotected
Adddeclare( strict_types = 1 );at the top of WooCommerce PHPUnit test files
WooCommerce PHPUnit test classes should extendWC_Unit_Test_Caseand include proper class documentation
Files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
**/*.{php,js,ts,jsx,tsx}
⚙️ CodeRabbit configuration file
**/*.{php,js,ts,jsx,tsx}: Don't trust that extension developers will follow the best practices, make sure the code:
- Guards against unexpected inputs.
- Sanitizes and validates any potentially dangerous inputs.
- Is backwards compatible.
- Is readable and intuitive.
- Has unit or E2E tests where applicable.
When making any changes to code that deletes or modifies orders/products/customer data, make sure that there are
sufficient checks in place to prevent accidental data loss. As an example, if deleting a draft order, check that
the order status is indeeddraftorcheckout-draft. Also think about whether race conditions could occur and
delete orders that don't belong to the current customer. When in doubt, ask for clarification in the PR comments.
Files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.phpplugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.jsplugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
plugins/woocommerce/includes/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Legacy WordPress code in
includes/directory should be modified minimally and only when necessary
Files:
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
🧠 Learnings (23)
📓 Common learnings
Learnt from: peterwilsoncc
Repo: woocommerce/woocommerce PR: 60447
File: plugins/woocommerce/templates/emails/email-order-details.php:96-131
Timestamp: 2025-10-23T01:44:03.397Z
Learning: In WooCommerce email templates (plugins/woocommerce/templates/emails/), when displaying order details, the order items table and order totals should be separate tables rather than combined with <tfoot>. This follows accessibility guidance: the totals are semantically different information from the line items and should not be forced into a single table structure just for visual positioning. The split improves accessibility for assistive technology users.
Learnt from: jamesckemp
Repo: woocommerce/woocommerce PR: 60816
File: plugins/woocommerce/includes/class-wc-post-types.php:485-492
Timestamp: 2025-09-12T13:24:41.207Z
Learning: In WooCommerce PR #60816, the shop_order post type registration correctly uses 'show_in_menu' => true to create a top-level Orders menu, moving away from the previous submenu structure under WooCommerce. This is intentional and aligns with the PR goal of promoting Orders to top-level navigation.
Learnt from: samueljseay
Repo: woocommerce/woocommerce PR: 58716
File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/iapi-frontend.ts:83-101
Timestamp: 2025-06-17T07:07:53.443Z
Learning: In WooCommerce blocks, when porting existing code patterns that have known issues (like parseInt truncating decimal money values), maintain consistency with existing implementation rather than making isolated fixes. The preference is for systematic refactoring approaches (like broader Dinero adoption) over piecemeal changes.
Learnt from: nerrad
Repo: woocommerce/woocommerce PR: 60176
File: plugins/woocommerce/client/legacy/css/admin.scss:9088-9105
Timestamp: 2025-08-04T00:21:51.440Z
Learning: WooCommerce is currently in the midst of an admin redesign project, so temporary/short-term CSS solutions for admin pages are preferred over long-term refactoring when addressing immediate needs.
📚 Learning: 2025-10-23T01:44:03.397Z
Learnt from: peterwilsoncc
Repo: woocommerce/woocommerce PR: 60447
File: plugins/woocommerce/templates/emails/email-order-details.php:96-131
Timestamp: 2025-10-23T01:44:03.397Z
Learning: In WooCommerce email templates (plugins/woocommerce/templates/emails/), when displaying order details, the order items table and order totals should be separate tables rather than combined with <tfoot>. This follows accessibility guidance: the totals are semantically different information from the line items and should not be forced into a single table structure just for visual positioning. The split improves accessibility for assistive technology users.
Applied to files:
plugins/woocommerce/changelog/2025-12-15-17-18-50-141498plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
📚 Learning: 2025-07-15T15:39:21.856Z
Learnt from: jorgeatorres
Repo: woocommerce/woocommerce PR: 59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.
Applied to files:
plugins/woocommerce/changelog/2025-12-15-17-18-50-141498
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Test behavior and interfaces, not implementation details, to ensure tests remain resilient when internal code changes
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.phpplugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Write one purpose per test - multiple assertions are acceptable if testing the same behavior, but avoid testing multiple unrelated behaviors in a single test method
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:15:16.065Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: .cursor/rules/woo-phpunit.mdc:0-0
Timestamp: 2025-11-24T16:15:16.065Z
Learning: Applies to plugins/woocommerce/tests/**/*.php : All test methods in WooCommerce PHPUnit tests must be declared as `public`, not `protected`
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:15:16.065Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: .cursor/rules/woo-phpunit.mdc:0-0
Timestamp: 2025-11-24T16:15:16.065Z
Learning: Applies to plugins/woocommerce/tests/**/*.php : WooCommerce PHPUnit test classes should extend `WC_Unit_Test_Case` and include proper class documentation
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Use setUp() and tearDown() methods to initialize test data and clean up resources, calling parent methods and resetting globals, deleted users, and other state
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:15:16.065Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: .cursor/rules/woo-phpunit.mdc:0-0
Timestamp: 2025-11-24T16:15:16.065Z
Learning: Applies to plugins/woocommerce/tests/**/*.php : All setUp() and tearDown() methods in WooCommerce PHPUnit test classes must be declared as `public`, not `protected`
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Structure tests using the Arrange-Act-Assert pattern: set up test data and mocks in Arrange, execute code being tested in Act, and verify expected behavior in Assert
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Use resilient assertions that won't break when adjacent code changes or new keys are added to data structures
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.phpplugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Name test methods as test_{feature}_{scenario}() or test_{feature}_{scenario}_{outcome}() to clearly describe what is being tested
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*IntegrationTest.php : For WordPress hook tests, use add_filter() or add_action() within tests to verify that hooks fire correctly by setting flags or tracking calls
Applied to files:
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
📚 Learning: 2025-11-24T16:13:56.953Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/client/settings-payments/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:56.953Z
Learning: Applies to plugins/woocommerce/client/admin/client/settings-payments/client/settings-payments/components/**/test/*.test.tsx : Test names must accurately describe what the test actually verifies, not what you wish they verified (e.g., describe actual verification performed, not presumed prop passing without mock inspection)
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:13:56.953Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/client/settings-payments/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:56.953Z
Learning: Applies to plugins/woocommerce/client/admin/client/settings-payments/packages/js/data/src/payment-settings/test/helpers/stub.ts : Update test stubs when modifying payment gateway features: `packages/js/data/src/payment-settings/test/helpers/stub.ts`
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-11T11:03:44.571Z
Learnt from: opr
Repo: woocommerce/woocommerce PR: 61507
File: plugins/woocommerce/tests/php/includes/rest-api/Controllers/Version4/Customers/class-wc-rest-customers-v4-controller-tests.php:638-638
Timestamp: 2025-11-11T11:03:44.571Z
Learning: In WooCommerce test files (plugins/woocommerce/tests/**/*.php), prefer explicit count assertions over scoping tests with parameters like `include` when testing pagination and default behaviors. Explicit counts test the specifics more reliably and help catch edge cases.
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:13:56.953Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/client/settings-payments/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:56.953Z
Learning: Applies to plugins/woocommerce/client/admin/client/settings-payments/client/settings-payments/components/**/test/*.test.tsx : Include edge case tests for defensive coding: test missing optional fields (undefined icon), undefined nested objects (supports array), invalid state combinations, and conflicting boolean flags
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:13:34.861Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:34.861Z
Learning: Applies to plugins/woocommerce/client/admin/**/*.test.{ts,tsx} : Generate coverage reports using `pnpm run test:js -- --coverage` to identify untested code paths
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:13:56.953Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/client/settings-payments/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:56.953Z
Learning: Applies to plugins/woocommerce/client/admin/client/settings-payments/client/settings-payments/components/**/test/*.test.tsx : Group component tests by concern using describe blocks: Basic Rendering, Status Badge Rendering, Button Rendering, Props Handling
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:13:56.953Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/client/settings-payments/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:56.953Z
Learning: Applies to plugins/woocommerce/client/admin/client/settings-payments/client/settings-payments/components/**/test/*.test.tsx : Component test files must follow the pattern: `components/[component-name]/test/[component-name].test.tsx`
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:14:26.363Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/tests/php/src/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:14:26.363Z
Learning: Applies to plugins/woocommerce/tests/php/src/tests/**/*Test.php : Use targeted assertions instead of full equality checks - break down array comparisons into individual assertions using assertArrayHasKey() and specific value assertions
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-11-24T16:13:34.861Z
Learnt from: CR
Repo: woocommerce/woocommerce PR: 0
File: plugins/woocommerce/client/admin/CLAUDE.md:0-0
Timestamp: 2025-11-24T16:13:34.861Z
Learning: Applies to plugins/woocommerce/client/admin/**/*.test.{ts,tsx} : Query DOM elements in React Testing Library tests using accessibility-first approach: prefer `getByRole`, then `getByLabelText`, then `getByText`, then `getByTitle` (in that priority order)
Applied to files:
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
📚 Learning: 2025-12-12T11:54:25.185Z
Learnt from: mikejolley
Repo: woocommerce/woocommerce PR: 62393
File: plugins/woocommerce/includes/class-wc-cart.php:1626-1635
Timestamp: 2025-12-12T11:54:25.185Z
Learning: In the WooCommerce plugin file plugins/woocommerce/includes/class-wc-cart.php (and related shipping code), keep package_id as a union type that accepts both int and string values to preserve backward compatibility with the REST API schema. Document that strict_types environments may raise TypeError if only strings are accepted, and consider testing REST payloads with mixed types. Do not convert to a strict string type; if downstream code relies on string methods, normalize at the boundary (e.g., coerce when reading from API) but do not change the API schema behavior.
Applied to files:
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
🧬 Code graph analysis (2)
plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php (1)
plugins/woocommerce/includes/abstracts/abstract-wc-order.php (1)
get_total_fees(1864-1872)
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php (1)
plugins/woocommerce/includes/abstracts/abstract-wc-order.php (3)
get_total_discount(510-517)get_currency(341-343)get_total_fees(1864-1872)
🔇 Additional comments (4)
plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js (1)
111-111: LGTM!The label updates from "Coupon(s)" to "Discount:" correctly reflect the UI change in the admin order totals and maintain exact matching for reliable assertions.
Also applies to: 135-135
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php (2)
179-179: LGTM!The label change from "Coupon(s):" to "Discount:" aligns with the PR objective to match the terminology used in customer emails and provides clearer, more consistent language across the order views.
186-186: Correct fix for displaying negative fees.The condition change from
0 < $order->get_total_fees()toabs( $order->get_total_fees() ) > 0properly enables display of both positive and negative fees while still hiding the row when the total is zero. Thewc_price()function on line 191 correctly handles negative values.plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php (1)
2104-2143: LGTM!The two new test methods provide good coverage for negative fee handling:
test_get_total_fees_should_return_negative_feesverifies single negative feetest_get_total_fees_should_sum_mixed_positive_and_negative_feesverifies mixed positive/negative fee summation (25 - 10 + 5.50 = 20.50)Both follow established patterns, use clear naming, and properly test the behavior that enables the admin UI fix.
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
straku
left a comment
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.
Tests well, implementation is clear 👍
Claude is taking an extreme stance towards backward compatibility here 😅
Changes proposed in this Pull Request:
In the admin order view when the total calculation is shown, discounts are named Coupon(s) which is not consistent with the email sent to customers where it is named Discount.
Also, negative fees are not shown in this calculation resulting in discrepencies when they are applied, meaning the Total (which is correct) does not actually match the sum of all the displayed components. Below is an example of an order with a £1 negative fee added.
The total sum of the components here adds up to £2.55 but the total is actually £1.55 because of the negative fee.
Closes WOOPLUG-5995
Closes #62386
Closes WOOPLUG-5989
Screenshots or screen recordings:
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
wp eval '$o = wc_get_order(123); $f = new WC_Order_Item_Fee(); $f->set_name("Test Discount"); $f->set_total(-1); $o->add_item($f); $o->calculate_totals(); $o->save();'(update the order ID)mu-pluginand run it once.View these emails and ensure the discounts for coupons show correctly, and that the negative fee, named "Test fee" is shown correctly.
Testing that has already taken place:
Milestone
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment