diff --git a/Modules/Sources/Yosemite/Stores/ProductStore.swift b/Modules/Sources/Yosemite/Stores/ProductStore.swift index 1a73dba5a2e..168227ac2cc 100644 --- a/Modules/Sources/Yosemite/Stores/ProductStore.swift +++ b/Modules/Sources/Yosemite/Stores/ProductStore.swift @@ -1368,6 +1368,7 @@ public enum ProductUpdateError: Error, Equatable { case duplicatedSKU case invalidSKU case invalidGlobalUniqueIdentifier + case invalidOrDuplicatedGlobalUniqueID case passwordCannotBeUpdated case notFoundInStorage case variationInvalidImageId @@ -1394,6 +1395,7 @@ public enum ProductUpdateError: Error, Equatable { private enum ErrorCode: String { case invalidSKU = "product_invalid_sku" + case invalidOrDuplicatedGlobalUniqueID = "product_invalid_global_unique_id" case variationInvalidImageId = "woocommerce_variation_invalid_image_id" case invalidMaxQuantity = "woocommerce_rest_invalid_max_quantity" case invalidMinQuantity = "woocommerce_rest_invalid_min_quantity" @@ -1408,6 +1410,8 @@ public enum ProductUpdateError: Error, Equatable { return .variationInvalidImageId case .invalidMaxQuantity, .invalidMinQuantity, .invalidVariationMaxQuantity, .invalidVariationMinQuantity: return .generic(message: message ?? "") + case .invalidOrDuplicatedGlobalUniqueID: + return .invalidOrDuplicatedGlobalUniqueID } } } @@ -1426,6 +1430,10 @@ extension ProductUpdateError: LocalizedError { return NSLocalizedString("productInventorySettings.invalidGlobalUniqueIdentifier.error", value: "Please enter only numbers and hyphens (-).", comment: "The message of the alert when there is an error updating the product global unique identifier") + case .invalidOrDuplicatedGlobalUniqueID: + return NSLocalizedString("productInventorySettings.error.invalidOrDuplicatedGlobalUniqueID", + value: "Invalid or duplicated GTIN, UPC, EAN or ISBN.", + comment: "Error message when saving an invalid or duplicated product global unique ID") case .generic(let message): return message case .unknown(let error): diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 33e9c87e99f..679ad8eba7c 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -4,6 +4,7 @@ 23.3 ----- - [*] Order details: Display only physical items in the Shipping Labels section. [https://github.com/woocommerce/woocommerce-ios/pull/16127] +- [*] Product form: Display user-friendly error message when saving duplicated GTIN/UPC/EAN/ISBN. [https://github.com/woocommerce/woocommerce-ios/pull/16146] - [internal] Address deprecated view modifiers usage following iOS17 API updates [https://github.com/woocommerce/woocommerce-ios/pull/16080] - [internal] POS Modularization: Removed direct ServiceLocator usage within POS by requiring complex Woo app target dependencies to be injected via POS dependency protocols, and moved reusable dependencies to WooFoundation and Yosemite [https://github.com/woocommerce/woocommerce-ios/pull/16132]