diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index c1665ca1a..6cce5c472 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -7005,6 +7005,10 @@ "src_dot_utils_dot_errors_dot_nameAlreadyTaken": { "string": "This name is already taken. Please provide another." }, + "src_dot_utils_dot_errors_dot_noCategorySet": { + "context": "no category set error", + "string": "Product category not set" + }, "src_dot_utils_dot_errors_dot_noShippingAddress": { "context": "error message", "string": "Cannot choose a shipping method for an order without the shipping address" diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index e3425ea21..7fa2322a4 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -300,7 +300,12 @@ export const ProductUpdate: React.FC = ({ id, params }) => { const [updateChannels, updateChannelsOpts] = useProductChannelListingUpdate({ onCompleted: data => { if (!!data.productChannelListingUpdate.errors.length) { - return; + data.productChannelListingUpdate.errors.forEach(error => + notify({ + status: "error", + text: getProductErrorMessage(error, intl) + }) + ); } } }); diff --git a/src/utils/errors/product.ts b/src/utils/errors/product.ts index fef746bdf..38209dfe4 100644 --- a/src/utils/errors/product.ts +++ b/src/utils/errors/product.ts @@ -50,6 +50,10 @@ const messages = defineMessages({ variantUnique: { defaultMessage: "This variant already exists", description: "product attribute error" + }, + noCategorySet: { + defaultMessage: "Product category not set", + description: "no category set error" } }); @@ -79,6 +83,8 @@ function getProductErrorMessage( return intl.formatMessage(messages.variantNoDigitalContent); case ProductErrorCode.UNSUPPORTED_MEDIA_PROVIDER: return intl.formatMessage(messages.unsupportedMediaProvider); + case ProductErrorCode.PRODUCT_WITHOUT_CATEGORY: + return intl.formatMessage(messages.noCategorySet); case ProductErrorCode.INVALID: if (err.field === "price") { return intl.formatMessage(messages.priceInvalid);