Skip to content

Order fulfillments entity project PR #57536

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

Merged
merged 62 commits into from
Jul 21, 2025

Conversation

tpaksu
Copy link
Contributor

@tpaksu tpaksu commented Apr 25, 2025

This is the PR of the order fulfillments entity feature branch. Don't merge this PR until all sub issues are closed on the task, and the feature is fully tested from end to end. And don't directly push commits on this branch.

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #57353 WOOPLUG-3968

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

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

Changelog Entry Comment

Comment

Introduced experimental fulfillment system, hidden behind a feature flag for beta testing.

tpaksu and others added 2 commits April 25, 2025 17:31
* Add new database tables for fulfillments

* Add changefile(s) from automation for the following project(s): woocommerce

* Update fulfillment tables to use CURRENT_TIMESTAMP for `date_updated`, which replaces `date_created`

* Add auto update to current timestamp

* Remove setting `date_updated` automatically, making it managed via code

* Add `status` and `is_fulfilled` columns to fulfillments table

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Vladimir Reznichenko <kalessil@gmail.com>
* Add new database tables for fulfillments

* Add changefile(s) from automation for the following project(s): woocommerce

* Initial commit

* Add fulfillment object and its data store

* Add changefile(s) from automation for the following project(s): woocommerce

* Move fulfillment related code to src folder

* Remove leftover code changes

* Fix unit test and linter error

* Update fulfillment tables to use CURRENT_TIMESTAMP for `date_updated`, which replaces `date_created`

* Add auto update to current timestamp

* Get datastore via dependency injection, rename date_created to date_updated

* Remove setting `date_updated` automatically, making it managed via code

* Convert errors to exceptions

* Add data and return types to class methods

* Add `status` and `is_fulfilled` columns to fulfillments table

* Refactor Fulfillment class to use data array for properties and update database insertion logic

* Add `read_fulfillments` method, add new column getters/setters, fix tests

* Set defaults, change reset approach

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Vladimir Reznichenko <kalessil@gmail.com>
@tpaksu tpaksu self-assigned this Apr 25, 2025
@tpaksu tpaksu linked an issue Apr 25, 2025 that may be closed by this pull request
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 25, 2025
@tpaksu tpaksu changed the title Order fulfillments entity project master PR Order fulfillments entity project PR Apr 25, 2025
tpaksu and others added 16 commits April 26, 2025 03:28
* Add new database tables for fulfillments

* Add changefile(s) from automation for the following project(s): woocommerce

* Initial commit

* Add fulfillment object and its data store

* Add changefile(s) from automation for the following project(s): woocommerce

* Move fulfillment related code to src folder

* Remove leftover code changes

* Fix unit test and linter error

* Update fulfillment tables to use CURRENT_TIMESTAMP for `date_updated`, which replaces `date_created`

* Add auto update to current timestamp

* Get datastore via dependency injection, rename date_created to date_updated

* Remove setting `date_updated` automatically, making it managed via code

* Convert errors to exceptions

* Add data and return types to class methods

* Initial commit

* Create the base REST controller file

* Register the REST controller on container, add service provider

* Rename ServiceProvider, omit RestController from the name

* Add strict types declaration

* Add base of the REST methods

* Add `status` and `is_fulfilled` columns to fulfillments table

* Refactor Fulfillment class to use data array for properties and update database insertion logic

* Add `read_fulfillments` method, add new column getters/setters, fix tests

* Set defaults, change reset approach

* Complete fulfillments REST controller code

* Start adding tests

* Fix helper namespace, add strict types check to helper file

* Add more tests

* Finish tests

* Remove meta id assertions from meta data  tests

* Remove date_deleted field from test

* Replace using body params with JSON params, fix tests

* Implement not applying actions on deleted records

* Allow arrays to be saved as meta by saving all meta as JSON encoded to the DB

* Reduce duplicated code, improve array validation

* Throw exception instead of returning an error on fulfillment validation

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Vladimir Reznichenko <kalessil@gmail.com>
* Initial commit

* Add fulfillments drawer renderer and component

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comments and method naming

* Add tests

* Add check for null screen

* Test returning internal meta keyse to fix unit test error on Github

* Fix non-static method called as static method

* Remove fix attempt as it didn't work

* Fix test error caused by container mock

* Address multiple issues

---------

Co-authored-by: github-actions <github-actions@github.com>
* Initial commit

* Add fulfillments drawer renderer and component

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comments and method naming

* Add tests

* Add check for null screen

* Test returning internal meta keyse to fix unit test error on Github

* Fix non-static method called as static method

* Remove fix attempt as it didn't work

* Fix test error caused by container mock

* Initial commit

* Add item listing and shipment information blocks

* Add checkbox selection details

* Fix bulk checkbox, add select all link

* Finish shipment information form

* Add notification box and buttons

* Add ShipmentFormContext, restructure components

* Refactor code, create fulfillments list

* Add fulfillment editor

* Fix items reverting after click, fix radio group on shipping options, keep order items visible when a fulfillment details are open

* Address multiple issues

* Add update, delete actions, shipping form manual edit names, componentize recurring code

* Add JS tests

* Fix issues with icons and images, add max-width to drawer

* Split PR into multiple PR's that solve only the focused issue

* Add disabled state when editing a fulfillment

* Disable other fulfillments when editing, add disabled states to buttons, fix test, fix fulfillment UI update after edit

* Add collapse to pending items, css styling

* Fix test

* Set order items open when no fulfillments are available

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Styling fixes, item price fixes

* Fix item selection

* Show new fulfillment form items as checked initially

* Skip disabling header on edit, exit edit mode on drawer close

* Small fixes

---------

Co-authored-by: github-actions <github-actions@github.com>
* Initial commit

* Add fulfillments drawer renderer and component

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comments and method naming

* Add tests

* Add check for null screen

* Test returning internal meta keyse to fix unit test error on Github

* Fix non-static method called as static method

* Remove fix attempt as it didn't work

* Fix test error caused by container mock

* Initial commit

* Add item listing and shipment information blocks

* Add checkbox selection details

* Fix bulk checkbox, add select all link

* Finish shipment information form

* Add notification box and buttons

* Add ShipmentFormContext, restructure components

* Refactor code, create fulfillments list

* Add fulfillment editor

* Fix items reverting after click, fix radio group on shipping options, keep order items visible when a fulfillment details are open

* Address multiple issues

* Add update, delete actions, shipping form manual edit names, componentize recurring code

* Add JS tests

* Fix issues with icons and images, add max-width to drawer

* Split PR into multiple PR's that solve only the focused issue

* Add disabled state when editing a fulfillment

* Disable other fulfillments when editing, add disabled states to buttons, fix test, fix fulfillment UI update after edit

* Add collapse to pending items, css styling

* Fix test

* Set order items open when no fulfillments are available

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add shipment information box and tests

* Fix fulfillment shipping settings not updating as expected, add constants for meta keys, disable changing values on lookup form, fix tests

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Styling fixes, item price fixes

* Fix item selection

* Replace H4's with component labels, apply design to tracking number lookup result,  add useMemo to context values

* Show new fulfillment form items as checked initially

* Change icon color, undisable header, disable edit mode before closing drawer

* Skip disabling header on edit, exit edit mode on drawer close

* Small fixes

* Increase meta list font size

---------

Co-authored-by: github-actions <github-actions@github.com>
* Initial commit

* Add fulfillments drawer renderer and component

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comments and method naming

* Add tests

* Add check for null screen

* Test returning internal meta keyse to fix unit test error on Github

* Fix non-static method called as static method

* Remove fix attempt as it didn't work

* Fix test error caused by container mock

* Initial commit

* Add item listing and shipment information blocks

* Add checkbox selection details

* Fix bulk checkbox, add select all link

* Finish shipment information form

* Add notification box and buttons

* Add ShipmentFormContext, restructure components

* Refactor code, create fulfillments list

* Add fulfillment editor

* Fix items reverting after click, fix radio group on shipping options, keep order items visible when a fulfillment details are open

* Address multiple issues

* Add update, delete actions, shipping form manual edit names, componentize recurring code

* Add JS tests

* Fix issues with icons and images, add max-width to drawer

* Split PR into multiple PR's that solve only the focused issue

* Add disabled state when editing a fulfillment

* Disable other fulfillments when editing, add disabled states to buttons, fix test, fix fulfillment UI update after edit

* Add collapse to pending items, css styling

* Fix test

* Set order items open when no fulfillments are available

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add shipment information box and tests

* Fix fulfillment shipping settings not updating as expected, add constants for meta keys, disable changing values on lookup form, fix tests

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add the fulfillment metadata display box

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Styling fixes, item price fixes

* Fix item selection

* Replace H4's with component labels, apply design to tracking number lookup result,  add useMemo to context values

* Show new fulfillment form items as checked initially

* Change icon color, undisable header, disable edit mode before closing drawer

* Skip disabling header on edit, exit edit mode on drawer close

* Small fixes

* Increase meta list font size

---------

Co-authored-by: github-actions <github-actions@github.com>
* Initial commit

* Add fulfillments drawer renderer and component

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comments and method naming

* Add tests

* Add check for null screen

* Test returning internal meta keyse to fix unit test error on Github

* Fix non-static method called as static method

* Remove fix attempt as it didn't work

* Fix test error caused by container mock

* Initial commit

* Add item listing and shipment information blocks

* Add checkbox selection details

* Fix bulk checkbox, add select all link

* Finish shipment information form

* Add notification box and buttons

* Add ShipmentFormContext, restructure components

* Refactor code, create fulfillments list

* Add fulfillment editor

* Fix items reverting after click, fix radio group on shipping options, keep order items visible when a fulfillment details are open

* Address multiple issues

* Add update, delete actions, shipping form manual edit names, componentize recurring code

* Add JS tests

* Fix issues with icons and images, add max-width to drawer

* Split PR into multiple PR's that solve only the focused issue

* Add disabled state when editing a fulfillment

* Disable other fulfillments when editing, add disabled states to buttons, fix test, fix fulfillment UI update after edit

* Add collapse to pending items, css styling

* Fix test

* Set order items open when no fulfillments are available

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add shipment information box and tests

* Fix fulfillment shipping settings not updating as expected, add constants for meta keys, disable changing values on lookup form, fix tests

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add the fulfillment metadata display box

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add customer notification box, connect it to REST API endpoints

* Styling fixes, item price fixes

* Fix item selection

* Replace H4's with component labels, apply design to tracking number lookup result,  add useMemo to context values

* Show new fulfillment form items as checked initially

* Change icon color, undisable header, disable edit mode before closing drawer

* Skip disabling header on edit, exit edit mode on drawer close

* Fix indenting errors after merge commit

* Add remove fulfilled fulfillment confirmation modal

* Small fixes

* Increase meta list font size

* Fix tests

* Add confirmation test

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

---------

Co-authored-by: github-actions <github-actions@github.com>
* Initial commit

* Add fulfillments drawer renderer and component

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comments and method naming

* Add tests

* Add check for null screen

* Test returning internal meta keyse to fix unit test error on Github

* Fix non-static method called as static method

* Remove fix attempt as it didn't work

* Fix test error caused by container mock

* Initial commit

* Add item listing and shipment information blocks

* Add checkbox selection details

* Fix bulk checkbox, add select all link

* Finish shipment information form

* Add notification box and buttons

* Add ShipmentFormContext, restructure components

* Refactor code, create fulfillments list

* Add fulfillment editor

* Fix items reverting after click, fix radio group on shipping options, keep order items visible when a fulfillment details are open

* Address multiple issues

* Add update, delete actions, shipping form manual edit names, componentize recurring code

* Add JS tests

* Fix issues with icons and images, add max-width to drawer

* Split PR into multiple PR's that solve only the focused issue

* Add disabled state when editing a fulfillment

* Disable other fulfillments when editing, add disabled states to buttons, fix test, fix fulfillment UI update after edit

* Add collapse to pending items, css styling

* Fix test

* Set order items open when no fulfillments are available

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add shipment information box and tests

* Fix fulfillment shipping settings not updating as expected, add constants for meta keys, disable changing values on lookup form, fix tests

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add the fulfillment metadata display box

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add customer notification box, connect it to REST API endpoints

* Styling fixes, item price fixes

* Fix item selection

* Replace H4's with component labels, apply design to tracking number lookup result,  add useMemo to context values

* Show new fulfillment form items as checked initially

* Change icon color, undisable header, disable edit mode before closing drawer

* Skip disabling header on edit, exit edit mode on drawer close

* Fix indenting errors after merge commit

* Add remove fulfilled fulfillment confirmation modal

* Small fixes

* Increase meta list font size

* Fix tests

* Add confirmation test

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Initial push

* Add fulfillment created emails and bind to actions

* Add plaintext fulfillment emails

* Add tests, rename file

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix code indentation error after merge

* Fix `woocommmerce` typo

* Fix comments and optimize code

---------

Co-authored-by: github-actions <github-actions@github.com>

This comment was marked as resolved.

tpaksu and others added 7 commits June 18, 2025 08:13
* Initial push

* Add customer order display modifications

* Fix error caused by null order

* Add changefile(s) from automation for the following project(s): woocommerce

* Add `_fulfilled_date` metadata automatically on fulfill

* Add date fulfilled getter/setter as a method of Fulfillment object

* Move fulfillment details into hook, fix file paths in comments

* Replace strong with mark on order status details text

* Replace &nbsp; with space

---------

Co-authored-by: github-actions <github-actions@github.com>
* Add lock meta and it's handling

* Add JS tests

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Update design

* Update plugins/woocommerce/client/admin/client/wp-admin-scripts/fulfillments/components/user-interface/lock-label.tsx

Co-authored-by: Fernando Espinosa <Ferdev@users.noreply.github.com>

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Fernando Espinosa <Ferdev@users.noreply.github.com>
* Initial push

* Add initial bulk actions code

* Handle fulfilling existing fulfillments of the order

* Add tests

* Add legacy CPT order type support

* Fix tests

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix utility method

* Remove unfulfill action

* Ensure items are saved as arrays

* Fix test

* Fix formatting after merge

---------

Co-authored-by: github-actions <github-actions@github.com>
* Add filter and action for fulfillment creation

* Remove metadata viewer test code

* Fix JS tests

* Refine fulfillment error message delivery via hooks

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Fix comment

* Modify fulfill items button to show message

* Optimize JS code

* Optimize missed JS code

* Remove code that tries to recreate fulfillment after deletion

* Fix alignment

* Apply patch to remove React checkbox component  warnings

---------

Co-authored-by: github-actions <github-actions@github.com>
* Initial push

* Add initial shipping providers support

* Fix tests

* Add strict types declaration

* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

* Add tests

* Fix test related to emails PR, unrelated with this one

* Improve comment, fix printing prices for orders without currency

* Use wp_localize_script instead of echo

* Revert wp_localize_script mods

---------

Co-authored-by: github-actions <github-actions@github.com>
tpaksu and others added 16 commits July 4, 2025 11:47
…er (#59298)

* Add shipping provider PNG image logos and replace base64 encoded images

* Add changefile(s) from automation for the following project(s): woocommerce

* Convert shipping provider configuration arrays into shipping provider classes, adapt UI and JS variable export to changes

* Add tests

* Fix namespace

* Fix class name case

* Fix another classname case issue

* Add tracking number parsing support for UPS shipping provider

* Fix shipping provider class initialization with DI

* Fix tracking number parse response handling

* Fix test

* Fix namespace of test file

* Add tracking number parsing support for USPS shipping provider

* Add ambiguity scoring

* Add ambiguity scoring

* Add tracking number parsing support for FedEx shipping provider

* Add tracking number parsing support for DHL shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).
-   Following the above guidelines will result in quick merges and clear and detailed feedback when appropriate.

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing DHL tracking numbers within the fulfillment provider system.

Closes #59204 WOOPLUG-4802

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if needed
5. In the shipping information box, enter the following tracking numbers:

#### ✅ Valid DHL
- `1234567890` (DE → US) → DHL (Score: 80)
- `JJD1234567890` (US → FR) → DHL (Score: 95)
- `JJD00123456789012` (GB → IT) → DHL (Score: 95)

#### ❌ Not DHL
- `INVALID1234` (DE → US)
- `JJD123` (JP → GB)
- `1234567890` (ZZ → US)

Verify correct results appear in the fulfillment drawer.

### Changelog entry

-   [x] This Pull Request does not require a changelog entry. (Comment required below)

<details>
<summary>Changelog Entry Details</summary>

#### Significance
-   [x] Patch

#### Type
-   [x] Add - Adds functionality

#### Message
</details>

<details>
<summary>Changelog Entry Comment</summary>

#### Comment
This is a part of a feature branch which will have a single changelog entry when merged to trunk.
</details>

* Add tracking number parsing support for Amazon Logistics shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing **Amazon Logistics (TBA...)** tracking numbers in the fulfillment provider system. Amazon tracking numbers typically start with `TBA` and are specific to Amazon's delivery network.

Closes #59233 WOOPLUG-4816

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if you don't have one.
5. In the fulfillment shipping info box, use tracking numbers like the following:

```md
- TBA1234567890 (US → US) → ✅ Amazon Logistics
- TBA000000000X (CA → CA) → ✅ Amazon Logistics
- tba111222333 (GB → DE) → ✅ Amazon Logistics
- TBX1234567890 (US → US) → ❌ Not Amazon Logistics
- TBA1234567890 (US → BR) → ❌ Not Amazon Logistics

* Fix tests

* Add tracking number parsing support for DPD shipping provider

* Shipping provider and test changes

* Modify USPS parser code

* Shipping provider changes

* Shipping provider changes

* Shipping provider changes

* Fix lint errors

* Shipping provider changes

* Fix linter error

* Add tracking number parsing support for Evri (Hermes) shipping provider

* Boost score when one of the countries is US

* Elaborate Surepost format

* Add all matches to parsing results, normalize tracking number

---------

Co-authored-by: github-actions <github-actions@github.com>
…#59308)

* Add shipping provider PNG image logos and replace base64 encoded images

* Add changefile(s) from automation for the following project(s): woocommerce

* Convert shipping provider configuration arrays into shipping provider classes, adapt UI and JS variable export to changes

* Add tests

* Fix namespace

* Fix class name case

* Fix another classname case issue

* Add tracking number parsing support for UPS shipping provider

* Fix shipping provider class initialization with DI

* Fix tracking number parse response handling

* Fix test

* Fix namespace of test file

* Add tracking number parsing support for USPS shipping provider

* Add ambiguity scoring

* Add ambiguity scoring

* Add tracking number parsing support for FedEx shipping provider

* Add tracking number parsing support for DHL shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).
-   Following the above guidelines will result in quick merges and clear and detailed feedback when appropriate.

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing DHL tracking numbers within the fulfillment provider system.

Closes #59204 WOOPLUG-4802

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if needed
5. In the shipping information box, enter the following tracking numbers:

#### ✅ Valid DHL
- `1234567890` (DE → US) → DHL (Score: 80)
- `JJD1234567890` (US → FR) → DHL (Score: 95)
- `JJD00123456789012` (GB → IT) → DHL (Score: 95)

#### ❌ Not DHL
- `INVALID1234` (DE → US)
- `JJD123` (JP → GB)
- `1234567890` (ZZ → US)

Verify correct results appear in the fulfillment drawer.

### Changelog entry

-   [x] This Pull Request does not require a changelog entry. (Comment required below)

<details>
<summary>Changelog Entry Details</summary>

#### Significance
-   [x] Patch

#### Type
-   [x] Add - Adds functionality

#### Message
</details>

<details>
<summary>Changelog Entry Comment</summary>

#### Comment
This is a part of a feature branch which will have a single changelog entry when merged to trunk.
</details>

* Add tracking number parsing support for Amazon Logistics shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing **Amazon Logistics (TBA...)** tracking numbers in the fulfillment provider system. Amazon tracking numbers typically start with `TBA` and are specific to Amazon's delivery network.

Closes #59233 WOOPLUG-4816

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if you don't have one.
5. In the fulfillment shipping info box, use tracking numbers like the following:

```md
- TBA1234567890 (US → US) → ✅ Amazon Logistics
- TBA000000000X (CA → CA) → ✅ Amazon Logistics
- tba111222333 (GB → DE) → ✅ Amazon Logistics
- TBX1234567890 (US → US) → ❌ Not Amazon Logistics
- TBA1234567890 (US → BR) → ❌ Not Amazon Logistics

* Fix tests

* Add tracking number parsing support for DPD shipping provider

* Shipping provider and test changes

* Modify USPS parser code

* Shipping provider changes

* Shipping provider changes

* Shipping provider changes

* Fix lint errors

* Shipping provider changes

* Fix linter error

* Add tracking number parsing support for Evri (Hermes) shipping provider

* Boost score when one of the countries is US

* Elaborate Surepost format

* Add all matches to parsing results, normalize tracking number

* Add Canada Post shipping provider tracking number parsing

* Add Canada Post icon

---------

Co-authored-by: github-actions <github-actions@github.com>
* Add shipping provider PNG image logos and replace base64 encoded images

* Add changefile(s) from automation for the following project(s): woocommerce

* Convert shipping provider configuration arrays into shipping provider classes, adapt UI and JS variable export to changes

* Add tests

* Fix namespace

* Fix class name case

* Fix another classname case issue

* Add tracking number parsing support for UPS shipping provider

* Fix shipping provider class initialization with DI

* Fix tracking number parse response handling

* Fix test

* Fix namespace of test file

* Add tracking number parsing support for USPS shipping provider

* Add ambiguity scoring

* Add ambiguity scoring

* Add tracking number parsing support for FedEx shipping provider

* Add tracking number parsing support for DHL shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).
-   Following the above guidelines will result in quick merges and clear and detailed feedback when appropriate.

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing DHL tracking numbers within the fulfillment provider system.

Closes #59204 WOOPLUG-4802

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if needed
5. In the shipping information box, enter the following tracking numbers:

#### ✅ Valid DHL
- `1234567890` (DE → US) → DHL (Score: 80)
- `JJD1234567890` (US → FR) → DHL (Score: 95)
- `JJD00123456789012` (GB → IT) → DHL (Score: 95)

#### ❌ Not DHL
- `INVALID1234` (DE → US)
- `JJD123` (JP → GB)
- `1234567890` (ZZ → US)

Verify correct results appear in the fulfillment drawer.

### Changelog entry

-   [x] This Pull Request does not require a changelog entry. (Comment required below)

<details>
<summary>Changelog Entry Details</summary>

#### Significance
-   [x] Patch

#### Type
-   [x] Add - Adds functionality

#### Message
</details>

<details>
<summary>Changelog Entry Comment</summary>

#### Comment
This is a part of a feature branch which will have a single changelog entry when merged to trunk.
</details>

* Add tracking number parsing support for Amazon Logistics shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing **Amazon Logistics (TBA...)** tracking numbers in the fulfillment provider system. Amazon tracking numbers typically start with `TBA` and are specific to Amazon's delivery network.

Closes #59233 WOOPLUG-4816

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if you don't have one.
5. In the fulfillment shipping info box, use tracking numbers like the following:

```md
- TBA1234567890 (US → US) → ✅ Amazon Logistics
- TBA000000000X (CA → CA) → ✅ Amazon Logistics
- tba111222333 (GB → DE) → ✅ Amazon Logistics
- TBX1234567890 (US → US) → ❌ Not Amazon Logistics
- TBA1234567890 (US → BR) → ❌ Not Amazon Logistics

* Fix tests

* Add tracking number parsing support for DPD shipping provider

* Shipping provider and test changes

* Modify USPS parser code

* Shipping provider changes

* Shipping provider changes

* Shipping provider changes

* Fix lint errors

* Shipping provider changes

* Fix linter error

* Add tracking number parsing support for Evri (Hermes) shipping provider

* Boost score when one of the countries is US

* Elaborate Surepost format

* Add all matches to parsing results, normalize tracking number

* Add Canada Post shipping provider tracking number parsing

* Add Canada Post icon

* Add Royal Mail shipping provider tracking number parsing

* Add S10 check digit validation for UPU format

* Fix wrong merge and failing tests because of it

* Fix comment

---------

Co-authored-by: github-actions <github-actions@github.com>
* Add shipping provider PNG image logos and replace base64 encoded images

* Add changefile(s) from automation for the following project(s): woocommerce

* Convert shipping provider configuration arrays into shipping provider classes, adapt UI and JS variable export to changes

* Add tests

* Fix namespace

* Fix class name case

* Fix another classname case issue

* Add tracking number parsing support for UPS shipping provider

* Fix shipping provider class initialization with DI

* Fix tracking number parse response handling

* Fix test

* Fix namespace of test file

* Add tracking number parsing support for USPS shipping provider

* Add ambiguity scoring

* Add ambiguity scoring

* Add tracking number parsing support for FedEx shipping provider

* Add tracking number parsing support for DHL shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).
-   Following the above guidelines will result in quick merges and clear and detailed feedback when appropriate.

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing DHL tracking numbers within the fulfillment provider system.

Closes #59204 WOOPLUG-4802

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if needed
5. In the shipping information box, enter the following tracking numbers:

#### ✅ Valid DHL
- `1234567890` (DE → US) → DHL (Score: 80)
- `JJD1234567890` (US → FR) → DHL (Score: 95)
- `JJD00123456789012` (GB → IT) → DHL (Score: 95)

#### ❌ Not DHL
- `INVALID1234` (DE → US)
- `JJD123` (JP → GB)
- `1234567890` (ZZ → US)

Verify correct results appear in the fulfillment drawer.

### Changelog entry

-   [x] This Pull Request does not require a changelog entry. (Comment required below)

<details>
<summary>Changelog Entry Details</summary>

#### Significance
-   [x] Patch

#### Type
-   [x] Add - Adds functionality

#### Message
</details>

<details>
<summary>Changelog Entry Comment</summary>

#### Comment
This is a part of a feature branch which will have a single changelog entry when merged to trunk.
</details>

* Add tracking number parsing support for Amazon Logistics shipping provider
### Submission Review Guidelines:

-   I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
-   I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
-   I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).

### Changes proposed in this Pull Request:

This PR adds initial support for detecting and parsing **Amazon Logistics (TBA...)** tracking numbers in the fulfillment provider system. Amazon tracking numbers typically start with `TBA` and are specific to Amazon's delivery network.

Closes #59233 WOOPLUG-4816

### How to test the changes in this Pull Request:

1. Checkout this branch
2. Run `pnpm run watch:build`
3. Run `composer dumpautoload` if needed
4. Go to WooCommerce > Orders and create a fulfillment if you don't have one.
5. In the fulfillment shipping info box, use tracking numbers like the following:

```md
- TBA1234567890 (US → US) → ✅ Amazon Logistics
- TBA000000000X (CA → CA) → ✅ Amazon Logistics
- tba111222333 (GB → DE) → ✅ Amazon Logistics
- TBX1234567890 (US → US) → ❌ Not Amazon Logistics
- TBA1234567890 (US → BR) → ❌ Not Amazon Logistics

* Fix tests

* Add tracking number parsing support for DPD shipping provider

* Shipping provider and test changes

* Modify USPS parser code

* Shipping provider changes

* Shipping provider changes

* Shipping provider changes

* Fix lint errors

* Shipping provider changes

* Fix linter error

* Add tracking number parsing support for Evri (Hermes) shipping provider

* Boost score when one of the countries is US

* Elaborate Surepost format

* Add all matches to parsing results, normalize tracking number

* Add Canada Post shipping provider tracking number parsing

* Add Canada Post icon

* Add Royal Mail shipping provider tracking number parsing

* Add S10 check digit validation for UPU format

* Add Australia Post shipping provider tracking number parsing

* Add Australia Post logo

* Join country list to one single line

* Fix lint error

---------

Co-authored-by: github-actions <github-actions@github.com>
* Add feature flag for order fulfillments

* Add changefile(s) from automation for the following project(s): woocommerce

* Isolate email modifications with feature flag

* Fix tests

* Move DB schema from installation to activation

* Add DB tables only when the feature is first enabled, hide feature UI

* Fix tests

* Fix more tests

* Remove the condition for adding fulfillments tables, make them always listed

---------

Co-authored-by: github-actions <github-actions@github.com>
* Change chevron direction, remove bulk selection labels, collapse new fulfillment form

* Prevent body scrolling on drawer open, refactor drawer classes, scroll to error message on error

* Make "Other" shipping provider option sticky at bottom

* Update order fulfillment status in real time

* Fix tests

* Disable collapsing when there's only one fulfillment with all items in the drawer

* Fix lint and test issues

* Fix hasPendingItems method, clear error messages when order changes

* Fix CSS style lint issues, formatter breaks it

* Fix scrollintoview margin issue

* Merge branch 'feature/57353-order-fulfillments-entity' into fix/58715-fix-design-review-problems

* Fix lint error caused by line length limit

* Align price text to right

* Fix lint error

* Add mocking for scrollIntoView in jest tests
* Add UX improvements for tracking number resolution

* Fix linter error

* Fix tests

* Remove unnecessary utility, fix conditional rendering
* Add refunds handling to fulfillments

* Don't remove refunded items from all fulfillments repeatingly, use counter

* Add tests

* Add FulfillmentUtilsTest initialization code

* Fix tests again
* Add validations for tracking numbers, add new formats, add global test

* Fix lint error

* Fix more lint errors

* Add some fixes for AMZL, AusPost and Evri

* Fix linter error

* More adjustments

* Fix tests in other files
* Standardize hook names, bump versions

* Remove extra changelog file

* Replace more findings
@kalessil kalessil marked this pull request as ready for review July 21, 2025 06:43
@kalessil kalessil self-requested a review July 21, 2025 06:43
Copy link
Contributor

Testing Guidelines

Hi @kalessil ,

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:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

Copy link
Contributor

github-actions bot commented Jul 21, 2025

Size Change: +20.4 kB (+0.35%)

Total Size: 5.88 MB

Filename Size Change
./plugins/woocommerce/client/blocks/build/product-collection.js 26.6 kB +879 B (+3.42%)
./plugins/woocommerce/client/admin/build/fulfillments/style-rtl.css 3.33 kB +3.33 kB (new file) 🆕
./plugins/woocommerce/client/admin/build/fulfillments/style.css 3.33 kB +3.33 kB (new file) 🆕
./plugins/woocommerce/client/admin/build/wp-admin-scripts/fulfillments.js 12.2 kB +12.2 kB (new file) 🆕

compressed-size-action

Copy link
Contributor

github-actions bot commented Jul 21, 2025

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

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.

Copy link
Contributor

@kalessil kalessil left a comment

Choose a reason for hiding this comment

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

CI passes: verified in #59806.

@kalessil kalessil merged commit 6d31426 into trunk Jul 21, 2025
10 of 13 checks passed
@kalessil kalessil deleted the feature/57353-order-fulfillments-entity branch July 21, 2025 09:11
Copy link
Contributor

⚠️ API Documentation Reminder

Hi @tpaksu! Your PR contains REST API changes. Please consider updating the REST API documentation if your changes affect the public API.

Changed API files:

plugins/woocommerce/src/Internal/Fulfillments/OrderFulfillmentsRestController.php

@github-actions github-actions bot added this to the 10.1.0 milestone Jul 21, 2025
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.

Order Fulfillment Entity Project
2 participants