Interner Hinweis gehört nicht in die Produktbeschreibung
Solange die Seife ein Entwurf war, las den Warnhinweis über die fehlende Zutatenliste niemand. Mit der Veröffentlichung stand er sichtbar auf der Produktseite — mitten im Werbetext und mit Warndreieck. Er wandert in die Metadaten: im Admin zu sehen, im Shop nicht. Das Frontend liest aus den Metadaten nur bestimmte Schlüssel, nie alle. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,10 +37,14 @@ const BILDER = [
|
|||||||
const BESCHREIBUNG =
|
const BESCHREIBUNG =
|
||||||
"Pflegeseife mit Milch und Honig aus unserer Imkerei. " +
|
"Pflegeseife mit Milch und Honig aus unserer Imkerei. " +
|
||||||
"Honig spendet Feuchtigkeit, Milch macht den Schaum weich und mild — " +
|
"Honig spendet Feuchtigkeit, Milch macht den Schaum weich und mild — " +
|
||||||
"angenehm für trockene Haut und für jeden Tag.\n\n" +
|
"angenehm für trockene Haut und für jeden Tag.";
|
||||||
"⚠️ Platzhalter: Gewicht, Duftrichtung und die vollständige Zutatenliste " +
|
|
||||||
"fehlen noch. Bei Seife ist die Angabe der Inhaltsstoffe (INCI) " +
|
/** Was noch fehlt, steht in den Metadaten statt in der Beschreibung: Im Admin
|
||||||
"vorgeschrieben, bevor sie verkauft werden darf.";
|
* ist es zu sehen, im Shop nicht. In der Beschreibung hätte es jeder Kunde
|
||||||
|
* gelesen, sobald das Produkt sichtbar wird. */
|
||||||
|
const OFFEN =
|
||||||
|
"Vor dem Verkauf: Zutatenliste (INCI) ergänzen — bei Kosmetik vorgeschrieben, " +
|
||||||
|
"auch im Versandhandel. Dazu Gewicht und Duftrichtung.";
|
||||||
|
|
||||||
export default async function ({ container }: any) {
|
export default async function ({ container }: any) {
|
||||||
const query = container.resolve("query");
|
const query = container.resolve("query");
|
||||||
@@ -106,21 +110,30 @@ export default async function ({ container }: any) {
|
|||||||
// 3. Die neue Seife.
|
// 3. Die neue Seife.
|
||||||
const { data: neue } = await query.graph({
|
const { data: neue } = await query.graph({
|
||||||
entity: "product",
|
entity: "product",
|
||||||
fields: ["id", "title", "handle", "status", "thumbnail"],
|
fields: ["id", "title", "handle", "status", "thumbnail", "description", "metadata"],
|
||||||
filters: { handle: [NEUE_SEIFE, ...FRUEHERE_HANDLES] },
|
filters: { handle: [NEUE_SEIFE, ...FRUEHERE_HANDLES] },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (neue?.[0]) {
|
if (neue?.[0]) {
|
||||||
const produkt = neue[0] as any;
|
const produkt = neue[0] as any;
|
||||||
|
|
||||||
if (produkt.handle !== NEUE_SEIFE || produkt.title !== TITEL) {
|
if (
|
||||||
|
produkt.handle !== NEUE_SEIFE ||
|
||||||
|
produkt.title !== TITEL ||
|
||||||
|
produkt.description !== BESCHREIBUNG
|
||||||
|
) {
|
||||||
await updateProductsWorkflow(container).run({
|
await updateProductsWorkflow(container).run({
|
||||||
input: {
|
input: {
|
||||||
selector: { id: produkt.id },
|
selector: { id: produkt.id },
|
||||||
update: { title: TITEL, handle: NEUE_SEIFE, description: BESCHREIBUNG },
|
update: {
|
||||||
|
title: TITEL,
|
||||||
|
handle: NEUE_SEIFE,
|
||||||
|
description: BESCHREIBUNG,
|
||||||
|
metadata: { ...(produkt.metadata ?? {}), offen: OFFEN },
|
||||||
|
},
|
||||||
} as any,
|
} as any,
|
||||||
});
|
});
|
||||||
logger.info(`Umbenannt in "${TITEL}".`);
|
logger.info(`"${TITEL}": Text und Notiz aktualisiert.`);
|
||||||
}
|
}
|
||||||
if (produkt.thumbnail !== BILDER[0]) {
|
if (produkt.thumbnail !== BILDER[0]) {
|
||||||
await updateProductsWorkflow(container).run({
|
await updateProductsWorkflow(container).run({
|
||||||
@@ -166,7 +179,7 @@ export default async function ({ container }: any) {
|
|||||||
images: BILDER.map((url) => ({ url })),
|
images: BILDER.map((url) => ({ url })),
|
||||||
shipping_profile_id: profile?.[0]?.id,
|
shipping_profile_id: profile?.[0]?.id,
|
||||||
sales_channels: kanaele?.[0] ? [{ id: kanaele[0].id }] : undefined,
|
sales_channels: kanaele?.[0] ? [{ id: kanaele[0].id }] : undefined,
|
||||||
metadata: { category: KATEGORIE, delivery_time: "2-3 Werktage" },
|
metadata: { category: KATEGORIE, delivery_time: "2-3 Werktage", offen: OFFEN },
|
||||||
category_ids: [kategorie.id],
|
category_ids: [kategorie.id],
|
||||||
options: [{ title: "Größe", values: ["Standard"] }],
|
options: [{ title: "Größe", values: ["Standard"] }],
|
||||||
variants: [
|
variants: [
|
||||||
|
|||||||
Reference in New Issue
Block a user