Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/humble-mice-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

New products are now created unpublished, unavailable, and unlisted by default
6 changes: 3 additions & 3 deletions src/channels/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ const createChannelsData = (data?: ChannelFragment[]): ChannelData[] =>
costPrice: "",
currency: channel.currencyCode,
id: channel.id,
isAvailableForPurchase: true,
isAvailableForPurchase: false,
variantsIds: [],
isPublished: true,
isPublished: false,
name: channel.name,
price: "",
publishedAt: null,
visibleInListings: true,
visibleInListings: false,
})) || [];

const createShippingChannels = (
Expand Down
9 changes: 2 additions & 7 deletions src/products/views/ProductCreate/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export function createHandler(
return { errors };
}

// Only set channel listings for simple products (no variants)
// Products with variants will have availability configured when variants are created
if (!hasVariants) {
const result = await Promise.all([
updateChannels(getChannelsVariables(productId, formData.channelListings)),
Expand All @@ -156,13 +158,6 @@ export function createHandler(
},
});
}
} else {
const result = await updateChannels(
getChannelsVariables(productId, formData.channelListings),
);
const channelErrors = result.data?.productChannelListingUpdate?.errors || [];

errors = [...errors, ...channelErrors];
}

/*
Expand Down
Loading