diff --git a/Changelog.md b/Changelog.md index ec1c1244..a751746b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ - Added and extended Foundation Channel model that contains the known relationships to the "channelable" models - Added the `withinChannel[s]` methods to the ProductSearch class - Added the `Features` accessor class, which is a syntactic sugar for areas of the configuration +- Added `isZoneRestricted()` & `isNotZoneRestricted()` helper methods to the `ShippingMethod` class - Fixed possible null return type on Billpayer::getName() when is_organization is true but the company name is null ## 3.x Series diff --git a/src/Shipment/Changelog.md b/src/Shipment/Changelog.md index 7a29a280..98e7289d 100644 --- a/src/Shipment/Changelog.md +++ b/src/Shipment/Changelog.md @@ -9,6 +9,7 @@ - Dropped Laravel 9 Support - Dropped Enum v3 Support - Changed minimal Enum requirement to v4.1 +- Added `isZoneRestricted()` & `isNotZoneRestricted()` helper methods to the `ShippingMethod` class ## 3.x Series diff --git a/src/Shipment/Models/ShippingMethod.php b/src/Shipment/Models/ShippingMethod.php index 7a77b77c..3a9ca6bd 100644 --- a/src/Shipment/Models/ShippingMethod.php +++ b/src/Shipment/Models/ShippingMethod.php @@ -85,6 +85,16 @@ public function estimate(?object $subject = null): ShippingFee return $this->getCalculator()->calculate($subject, $this->configuration()); } + public function isZoneRestricted(): bool + { + return null !== $this->zone_id; + } + + public function isNotZoneRestricted(): bool + { + return !$this->isZoneRestricted(); + } + public function zone(): BelongsTo { return $this->belongsTo(ZoneProxy::modelClass(), 'zone_id', 'id');