From 831c23c4bdcd35f2ec61ce588ab15ef52c77e2dc Mon Sep 17 00:00:00 2001 From: vendidero Date: Tue, 16 Jul 2024 10:03:29 +0200 Subject: [PATCH] Throw exception in case shipment misses id after save. --- src/Shipment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Shipment.php b/src/Shipment.php index b1f3cd9..0e684d4 100644 --- a/src/Shipment.php +++ b/src/Shipment.php @@ -2978,6 +2978,10 @@ public function save() { } } + if ( ! $this->get_id() ) { + throw new \Exception( 'Error while saving shipment.' ); + } + $this->save_items(); if ( $cache = Helper::get_cache_object( 'shipments' ) ) {