fix(admin-ui): Fix variant creation when no stock locations provided (#4843)

* Update check on variant creation, whether to create stock locations

* Create spicy-shoes-type.md
This commit is contained in:
Rares Stefan
2023-08-24 07:51:12 +01:00
committed by GitHub
parent 57e199ef52
commit f4bf9ee169
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/admin-ui": patch
"@medusajs/admin": patch
---
fix(admin-ui): Fix variant creation when no stock locations provided

View File

@@ -79,7 +79,7 @@ const AddVariantModal = ({ open, onClose, product }: Props) => {
delete data.stock.stock_location
onAddVariant(createAddPayload(data), (productRes) => {
if (typeof stock_location !== "undefined") {
if (stock_location?.length) {
createStockLocationsForVariant(productRes, stock_location).then(() => {
resetAndClose()
})