Skip to content

Commit

Permalink
fix tracking data metabox failing to save in HPOS mode
Browse files Browse the repository at this point in the history
  • Loading branch information
petitphp committed Mar 7, 2024
1 parent 58a30cc commit e907e72
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Admin/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Order {

public function __construct() {
add_action( 'add_meta_boxes', array( $this, 'register_sfa_tracking_details_metabox' ), 100 );
add_action( 'save_post', array( $this, 'save_sfa_tracking_details_metabox' ) );
add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_sfa_tracking_details_metabox' ) );
}

public function save_sfa_tracking_details_metabox( $post_id ) {
Expand Down Expand Up @@ -42,9 +42,7 @@ public function save_sfa_tracking_details_metabox( $post_id ) {
);
}
if ( isset( $_POST[ TRACKING_NUMBER_FIELD_SLUG ] ) || isset( $_POST[ TRACKING_LINK_FIELD_SLUG ] ) ) {
remove_action( 'save_post', array( $this, 'save_sfa_tracking_details_metabox' ) );
$order->save();
add_action( 'save_post', array( $this, 'save_sfa_tracking_details_metabox' ) );
}
}

Expand Down

0 comments on commit e907e72

Please sign in to comment.