diff --git a/Model/Config.php b/Model/Config.php
index 617050f..966554f 100644
--- a/Model/Config.php
+++ b/Model/Config.php
@@ -564,11 +564,15 @@ public function showWidgetOnFirstLoad($store = null)
/**
* @param null|Store|int|string $store
- * @return float
+ * @return float|null
*/
- public function getInsuranceValue($store = null)
+ public function getInsuranceValue($store = null): ?float
{
- return abs((float)$this->getValue(self::API_CONFIG_PATH . '/insurance_value', $store));
+ $value = $this->getValue(self::API_CONFIG_PATH . '/insurance_value', $store);
+ if ($value === null || $value === '') {
+ return null;
+ }
+ return abs((float)$value);
}
/**
diff --git a/Test/Unit/Model/Api/Builder/OrderTest.php b/Test/Unit/Model/Api/Builder/OrderTest.php
index c55e51d..795fd71 100644
--- a/Test/Unit/Model/Api/Builder/OrderTest.php
+++ b/Test/Unit/Model/Api/Builder/OrderTest.php
@@ -275,8 +275,8 @@ public function testOrderInsuredValue($configValue, $orderCurrency)
public function orderInsuredValueDataProvider()
{
return [
- [0, 'EUR'],
- [0, 'USD'],
+ [null, 'EUR'],
+ [null, 'USD'],
[1.05, 'EUR'],
[20.19, 'USD'],
[201.36363, 'USD'],
diff --git a/composer.json b/composer.json
index 91799ec..aab7f72 100755
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "paazl/magento2-checkout-widget",
"description": "Paazl checkoutWidget for Magento 2",
"type": "magento2-module",
- "version": "1.17.1",
+ "version": "1.17.2",
"keywords": [
"Paazl",
"Magento 2",
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 5e7e023..fd0c773 100755
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -164,7 +164,7 @@
1
- Fill in the insurance amount as a number.
+ Fill in the insurance amount as a number. Null will be added if the value is empty.
diff --git a/etc/config.xml b/etc/config.xml
index dc5a394..f42d708 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -8,7 +8,7 @@
- v1.17.1
+ v1.17.2
0
0
0
diff --git a/view/frontend/web/js/checkout/action/set-shipping-information-mixin.js b/view/frontend/web/js/checkout/action/set-shipping-information-mixin.js
index 53ce257..a2386d7 100755
--- a/view/frontend/web/js/checkout/action/set-shipping-information-mixin.js
+++ b/view/frontend/web/js/checkout/action/set-shipping-information-mixin.js
@@ -55,7 +55,7 @@ define([
const shippingAddress = quote.billingAddress();
let currentAddress;
- if (isCustomerLogin) {
+ if (isCustomerLogin && Object.keys(window.checkoutConfig.customerData.addresses).length > 0) {
currentAddress = selectedShippingAddress === 'new-customer-address'
? customerData.get('checkout-data')().shippingAddressFromData
: window.checkoutConfig.customerData.addresses[getAddressId()];