Code Duplication    Length = 5-5 lines in 2 locations

includes/class-wc-ajax.php 2 locations

@@ 879-883 (lines=5) @@
876
			// If we passed through items it means we need to save first before adding a new one.
877
			$items = ( ! empty( $_POST['items'] ) ) ? wp_unslash( $_POST['items'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
878
879
			if ( ! empty( $items ) ) {
880
				$save_items = array();
881
				parse_str( $items, $save_items );
882
				wc_save_order_items( $order->get_id(), $save_items );
883
			}
884
885
			$items_to_add = isset( $_POST['data'] ) ? array_filter( wp_unslash( (array) $_POST['data'] ) ) : array(); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
886
@@ 1254-1258 (lines=5) @@
1251
			}
1252
1253
			// If we passed through items it means we need to save first before deleting.
1254
			if ( ! empty( $items ) ) {
1255
				$save_items = array();
1256
				parse_str( $items, $save_items );
1257
				wc_save_order_items( $order->get_id(), $save_items );
1258
			}
1259
1260
			if ( ! empty( $order_item_ids ) ) {
1261
				$order_notes = array();