mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Dont get tracking if tracking number meta doesn't exist
This commit is contained in:
parent
dade07ca95
commit
92e4b65220
2 changed files with 6 additions and 4 deletions
|
@ -185,8 +185,12 @@ class OrderTrackingEndpoint {
|
|||
throw new RuntimeException( 'wrong order ID' );
|
||||
}
|
||||
|
||||
if ( ! $wc_order->meta_exists( '_ppcp_paypal_tracking_number' ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transaction_id = $wc_order->get_transaction_id();
|
||||
$tracking_number = get_post_meta( $wc_order_id, '_ppcp_paypal_tracking_number', true );
|
||||
$tracking_number = $wc_order->get_meta( '_ppcp_paypal_tracking_number', true );
|
||||
$url = trailingslashit( $this->host ) . 'v1/shipping/trackers/' . $this->find_tracker_id( $transaction_id, $tracking_number );
|
||||
|
||||
$args = array(
|
||||
|
|
|
@ -80,8 +80,6 @@ class MetaBoxRenderer {
|
|||
|
||||
$tracking_info = $this->order_tracking_endpoint->get_tracking_information( $wc_order->get_id() );
|
||||
|
||||
$tracking_is_not_added = empty( $tracking_info );
|
||||
|
||||
$transaction_id = $tracking_info['transaction_id'] ?? $wc_order->get_transaction_id() ?: '';
|
||||
$tracking_number = $tracking_info['tracking_number'] ?? '';
|
||||
$status_value = $tracking_info['status'] ?? 'SHIPPED';
|
||||
|
@ -90,7 +88,7 @@ class MetaBoxRenderer {
|
|||
$carriers = (array) apply_filters( 'ppcp_tracking_carriers', $this->carriers );
|
||||
$statuses = (array) apply_filters( 'ppcp_tracking_statuses', $this->allowed_statuses );
|
||||
|
||||
$action = $tracking_is_not_added ? 'create' : 'update';
|
||||
$action = ! $tracking_info ? 'create' : 'update';
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( self::NAME_PREFIX ); ?>-transaction_id"><?php echo esc_html__( 'Transaction ID', 'woocommerce-paypal-payments' ); ?></label>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue