Skip to content

[Backport to release/10.7] [WOOPLUG-6360+6047] Add custom shipping providers and provider filter#63879

Merged
tpaksu merged 1 commit intorelease/10.7from
cherry-pick-PR63766-to-release/10.7
Mar 26, 2026
Merged

[Backport to release/10.7] [WOOPLUG-6360+6047] Add custom shipping providers and provider filter#63879
tpaksu merged 1 commit intorelease/10.7from
cherry-pick-PR63766-to-release/10.7

Conversation

@woocommercebot
Copy link
Copy Markdown
Collaborator

This PR is a cherry-pick of #63766 to release/10.7.

Original PR Description

Submission Review Guidelines:

Fixes WOOPLUG-6360 WOOPLUG-6047

Changes proposed in this Pull Request:

This PR implements two related features for the WooCommerce Fulfillments system:

WOOPLUG-6360: Custom Shipping Providers

  • Registers a wc_fulfillment_shipping_provider WordPress taxonomy to store custom providers
  • Adds a CustomShippingProvider class extending AbstractShippingProvider with tracking URL template support (__PLACEHOLDER__ replacement)
  • Loads custom providers into the existing woocommerce_fulfillment_shipping_providers filter at priority 20 (after built-ins at 10)
  • Adds a "Shipping providers" tab under WooCommerce > Settings > Shipping with a Backbone.js CRUD UI (following the exact shipping classes pattern)
  • Adds an AJAX handler (shipping_providers_save_changes) for create/update/delete operations
  • Custom providers automatically appear in the fulfillment form dropdown

WOOPLUG-6047: Filter by Shipping Provider

  • Adds a "Filter by shipping provider" dropdown to the orders list table (both HPOS and legacy)
  • Includes all built-in and custom providers, plus an "Other" option for free-text providers
  • Filters orders by joining wc_order_fulfillments and wc_order_fulfillment_meta tables

Closes # .

Screenshots or screen recordings:

Before After

How to test the changes in this Pull Request:

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

Basic functionality

  1. Enable the Fulfillments feature flag (woocommerce_feature_fulfillments_enabled = yes).
  2. Navigate to WooCommerce > Settings > Shipping > Shipping providers.
  3. Click "Add shipping provider" and create a provider with a name (e.g. "My Local Courier"), tracking URL template (e.g. https://example.com/track?id=__PLACEHOLDER__), and optionally a slug and icon URL.
  4. Verify the provider appears in the table. Edit and delete it to confirm CRUD works.
  5. Create a new order and open the fulfillment drawer. Verify the custom provider appears in the provider dropdown.
  6. Select the custom provider and enter a tracking number. Verify the tracking URL auto-fills with the template (placeholder replaced).
  7. Navigate to WooCommerce > Orders. Verify the "Filter by shipping provider" dropdown appears next to the fulfillment status filter.
  8. Create fulfillments with different providers on several orders. Filter by a specific provider and verify only matching orders are shown.
  9. Filter by "Other" and verify orders with free-text (non-listed) providers are shown.

Slug uniqueness and immutability

  1. Try to create a custom provider with slug ups (or any built-in provider key). Verify it is rejected with an error message about the slug being already in use.
  2. Create a custom provider with name "UPS Freight" and no slug. Verify the auto-generated slug is checked against built-in keys and rejected if it collides (e.g. if it auto-generates to ups).
  3. Create a custom provider with a unique slug. Edit it afterwards. Verify the slug field is read-only in the edit modal and cannot be changed.

URL validation

  1. Try creating a provider with an invalid tracking URL template (e.g. not-a-url). Verify the value is silently discarded (stored as empty).
  2. Try creating a provider with an ftp:// or javascript: tracking URL. Verify it is rejected (only http:// and https:// are accepted).
  3. Try creating a provider with an invalid icon URL. Verify it is silently discarded.
  4. Edit an existing provider that has a valid tracking URL. Submit the edit modal with an invalid URL in the tracking URL field. Verify the previously saved valid URL is preserved (not wiped).
  5. Edit an existing provider. Clear the tracking URL field entirely and save. Verify the tracking URL is now empty (intentional clear works).

Deletion protection

  1. Create a custom provider (e.g. "Test Courier").
  2. Create an order and add a fulfillment using "Test Courier" as the shipping provider.
  3. Go back to WooCommerce > Settings > Shipping > Shipping providers and try to delete "Test Courier". Verify deletion is blocked with an error message explaining it is used by existing fulfillments.
  4. Delete the fulfillment from the order. Now try deleting "Test Courier" again. Verify it succeeds.

Feature flag gating

  1. Disable the fulfillments feature flag (woocommerce_feature_fulfillments_enabled = no).
  2. Verify the "Shipping providers" tab no longer appears under WooCommerce > Settings > Shipping.
  3. Navigate directly to ?page=wc-settings&tab=shipping&section=fulfillment-providers. Verify the providers screen does not render.

Placeholder icon (TruckIcon fallback)

  1. Create a custom provider without an icon URL.
  2. Create a fulfillment using this provider. Verify:
    • In the provider dropdown, a truck icon appears next to the provider name (not a blank space).
    • In the shipment viewer (collapsed fulfillment card), a truck icon appears instead of a broken image.

Testing that has already taken place:

  • PHPUnit tests: 24 tests passing (8 for CustomShippingProviderTest, 16 for FulfillmentsManagerTest)
  • JS tests: 26 tests passing (shipment-viewer, shipment-manual-entry-form, shipment-tracking-number-form)
  • PHP linting: clean (phpcs-changed)
  • PHPStan: clean (no new errors)

Milestone

Note: Check the box above to have the milestone automatically assigned when merged.
Alternatively (e.g. for point releases), manually assign the appropriate milestone.

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

Add custom shipping providers settings UI and shipping provider filter for the orders list.

Changelog Entry Comment

Comment

@github-actions
Copy link
Copy Markdown
Contributor

Testing Guidelines

Hi @tpaksu ,

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.

@github-actions github-actions Bot added this to the 10.7.0 milestone Mar 26, 2026
@github-actions github-actions Bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Mar 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Size Change: +3.48 kB (+0.06%)

Total Size: 5.98 MB

Filename Size Change
./plugins/woocommerce/client/legacy/build/js/admin/wc-shipping-providers.js 2.02 kB +2.02 kB (new file) 🆕
./plugins/woocommerce/client/legacy/build/js/admin/wc-shipping-providers.min.js 1.47 kB +1.47 kB (new file) 🆕

compressed-size-action

@tpaksu tpaksu enabled auto-merge (squash) March 26, 2026 14:21
@github-actions
Copy link
Copy Markdown
Contributor

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.

@tpaksu tpaksu merged commit df18338 into release/10.7 Mar 26, 2026
64 of 65 checks passed
@tpaksu tpaksu deleted the cherry-pick-PR63766-to-release/10.7 branch March 26, 2026 15:08
@github-actions github-actions Bot added needs: documentation The issue/PR requires documentation to be added. metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. labels Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. needs: documentation The issue/PR requires documentation to be added. plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants