woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
61 stars 47 forks source link

Add shipping causes 500 error with WooCommerce Shipment Tracking #2295

Closed Wimmie closed 1 month ago

Wimmie commented 1 month ago

Describe the Bug

When adding a tracking number using the plugin WooCommerce Shipment Tracking the request fails. The tracking will be added, but the request results in a 500 error. This is because the "wp_ajax_wc_shipment_tracking_save_form" hook is fired by the plugin. When the order has not been paid, then an exeption with "PayPal order ID not found in meta." is thrown.

To Reproduce

  1. Go to a order that has NOT been paid using PayPal
  2. Add a tracking number
  3. See error in network tab of browser

Screenshots

afbeelding

Expected Behavior

A tracking code is added without an error for orders that are not paid using PayPal

Actual Behavior

A tracking code is added with an error for order that are not paid using PayPal

Environment

Additional Details

It is possible that an order is not paid using PayPal, therefore I think the function should check that the order has been paid using PayPal before syncing the tracking details.

The error has been caused by the following commit in file ShipmentTrackingIntegration: https://github.com/woocommerce/woocommerce-paypal-payments/commit/068142ac2faaaf4315d2265a8203df29416a0e17

Wimmie commented 1 month ago

Sorry, did not check the closed issues, this is a duplicate of https://github.com/woocommerce/woocommerce-paypal-payments/issues/2287 and fixed by https://github.com/woocommerce/woocommerce-paypal-payments/pull/2289