Skip to content

Commit 959c8ac

Browse files
authored
Product Form: Show clear error message for duplicated GTIN/UPC/EAN/ISBN (#16146)
2 parents 24eb45c + 1bf7cb3 commit 959c8ac

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Modules/Sources/Yosemite/Stores/ProductStore.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,7 @@ public enum ProductUpdateError: Error, Equatable {
13671367
case duplicatedSKU
13681368
case invalidSKU
13691369
case invalidGlobalUniqueIdentifier
1370+
case invalidOrDuplicatedGlobalUniqueID
13701371
case passwordCannotBeUpdated
13711372
case notFoundInStorage
13721373
case variationInvalidImageId
@@ -1393,6 +1394,7 @@ public enum ProductUpdateError: Error, Equatable {
13931394

13941395
private enum ErrorCode: String {
13951396
case invalidSKU = "product_invalid_sku"
1397+
case invalidOrDuplicatedGlobalUniqueID = "product_invalid_global_unique_id"
13961398
case variationInvalidImageId = "woocommerce_variation_invalid_image_id"
13971399
case invalidMaxQuantity = "woocommerce_rest_invalid_max_quantity"
13981400
case invalidMinQuantity = "woocommerce_rest_invalid_min_quantity"
@@ -1407,6 +1409,8 @@ public enum ProductUpdateError: Error, Equatable {
14071409
return .variationInvalidImageId
14081410
case .invalidMaxQuantity, .invalidMinQuantity, .invalidVariationMaxQuantity, .invalidVariationMinQuantity:
14091411
return .generic(message: message ?? "")
1412+
case .invalidOrDuplicatedGlobalUniqueID:
1413+
return .invalidOrDuplicatedGlobalUniqueID
14101414
}
14111415
}
14121416
}
@@ -1425,6 +1429,10 @@ extension ProductUpdateError: LocalizedError {
14251429
return NSLocalizedString("productInventorySettings.invalidGlobalUniqueIdentifier.error",
14261430
value: "Please enter only numbers and hyphens (-).",
14271431
comment: "The message of the alert when there is an error updating the product global unique identifier")
1432+
case .invalidOrDuplicatedGlobalUniqueID:
1433+
return NSLocalizedString("productInventorySettings.error.invalidOrDuplicatedGlobalUniqueID",
1434+
value: "Invalid or duplicated GTIN, UPC, EAN or ISBN.",
1435+
comment: "Error message when saving an invalid or duplicated product global unique ID")
14281436
case .generic(let message):
14291437
return message
14301438
case .unknown(let error):

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
23.3
55
-----
66
- [*] Order details: Display only physical items in the Shipping Labels section. [https://github.com/woocommerce/woocommerce-ios/pull/16127]
7+
- [*] Product form: Display user-friendly error message when saving duplicated GTIN/UPC/EAN/ISBN. [https://github.com/woocommerce/woocommerce-ios/pull/16146]
78
- [internal] Address deprecated view modifiers usage following iOS17 API updates [https://github.com/woocommerce/woocommerce-ios/pull/16080]
89
- [***] Performance improvements for users logging in with WordPress.com accounts [https://github.com/woocommerce/woocommerce-ios/pull/16126]
910
- [internal] Fix back swipe gesture detection compatibility for iOS26 [https://github.com/woocommerce/woocommerce-ios/pull/16133]

0 commit comments

Comments
 (0)