Skip to content

fix: sync WooCommerce Shipment Tracking to PayPal again - #4747

Merged
Dinamiko merged 3 commits into
dev/developfrom
dev/PCP-6263-package-tracking-breaks-compatibility-with-woo-commerce-shipment-tracking
Sep 28, 2026
Merged

Dinamiko merged 3 commits into
dev/developfrom
dev/PCP-6263-package-tracking-breaks-compatibility-with-woo-commerce-shipment-tracking

Conversation

@Narek13

@Narek13 Narek13 commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Tracking added through WooCommerce Shipment Tracking never reached PayPal. The PayPal Package Tracking box stayed empty and nothing appeared in the logs.

Why

Both plugins answer wp_ajax_wc_shipment_tracking_save_form at the default priority. WooCommerce Shipment Tracking registers first and ends its handler with die(), so ours never ran:

prio 10   WC_Shipment_Tracking_Actions::save_meta_box_ajax    <- runs first, die()
prio 10   Closure  ShipmentTrackingIntegration.php:75         <- never reached

The only logging sits inside that callback, which is why the report stood since April with nothing to go on.

The fix

Priority 5, ahead of that handler. The callback reads the tracking from the request, not from what the other plugin stores, so running first costs it nothing.

Hooking wc_shipment_tracking_before_add_tracking_items would be tidier but it is absent from older versions, and the compat gate checks no version at all.

Verified

On the admin order screen with WooCommerce Shipment Tracking 2.3.1:

  • reverted — add tracking, PayPal box stays empty, log silent
  • applied — add tracking, the shipment appears

ShipStation, which the ticket also names, was tested separately and works: firing woocommerce_shipstation_shipnotify synced the tracking to PayPal and it reads back. Its integration hooks ShipStation's own action, so this trap never applied. That half of the report does not reproduce.

Test steps

  1. Activate WooCommerce Shipment Tracking, enable PayPal logging.
  2. Open a PayPal-paid order whose capture still resolves, so the PayPal box renders.
  3. Add tracking in WooCommerce's Shipment Tracking box.
  4. Expected: the shipment appears in PayPal Package Tracking Status. If PayPal rejects it, the log now says Couldn't sync tracking information: … — either way the callback ran.
  5. Tracking added over REST is unchanged.

…e request

Tracking a merchant added through WooCommerce Shipment Tracking never reached
PayPal. Both plugins answer the same AJAX action at the default priority, and
that plugin registers first and ends its own handler with die(), so this
callback was never reached at all.

Nothing was logged, because the code that logs sits inside the callback that
never ran, which is why the report stood for months with nothing to go on.

Priority 5 puts it ahead of that handler. It reads the tracking from the
request rather than from what the other plugin stores, so running first costs
it nothing.
The registration is the regression: drop the priority argument and the sync
stops silently, with nothing failing and nothing logged. Covered alongside the
REST path it shares the class with, and the submissions that should and should
not reach PayPal.
@github-actions

Copy link
Copy Markdown

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

What's included:

  • ✅ WordPress (latest)
  • ✅ WooCommerce (latest)
  • ✅ PayPal Payments plugin v4.1.3-pr4747-36132993729-gfebe8ac (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 4.1.3-pr4747-36132993729-gfebe8ac
  • Commit: f03300c
  • Artifact: woocommerce-paypal-payments-4.1.3-pr4747-36132993729-gfebe8ac

💡 The demo environment resets each time you refresh. Perfect for testing!

🔄 This link updates automatically with each new commit to the PR.

⚠️ This URL is valid for 30 days from when this comment was last updated.


🤖 Auto-generated for commit f03300c • Last updated: 2026-09-25T12:09:14.008Z

@Narek13 Narek13 self-assigned this Sep 25, 2026
@Narek13 Narek13 added order-tracking bug Something isn't working labels Sep 25, 2026
Three lines rather than six, and a block comment, which is the house style for
more than one line above a hook registration.
@InpsydeNiklas InpsydeNiklas added this to the 4.2.0 milestone Sep 25, 2026
@Dinamiko
Dinamiko merged commit bd66cde into dev/develop Sep 28, 2026
12 checks passed
@Dinamiko
Dinamiko deleted the dev/PCP-6263-package-tracking-breaks-compatibility-with-woo-commerce-shipment-tracking branch September 28, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working order-tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants