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 =
|
||||
"Pflegeseife mit Milch und Honig aus unserer Imkerei. " +
|
||||
"Honig spendet Feuchtigkeit, Milch macht den Schaum weich und mild — " +
|
||||
"angenehm für trockene Haut und für jeden Tag.\n\n" +
|
||||
"⚠️ Platzhalter: Gewicht, Duftrichtung und die vollständige Zutatenliste " +
|
||||
"fehlen noch. Bei Seife ist die Angabe der Inhaltsstoffe (INCI) " +
|
||||
"vorgeschrieben, bevor sie verkauft werden darf.";
|
||||
"angenehm für trockene Haut und für jeden Tag.";
|
||||
|
||||
/** Was noch fehlt, steht in den Metadaten statt in der Beschreibung: Im Admin
|
||||
* 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) {
|
||||
const query = container.resolve("query");
|
||||
@@ -106,21 +110,30 @@ export default async function ({ container }: any) {
|
||||
// 3. Die neue Seife.
|
||||
const { data: neue } = await query.graph({
|
||||
entity: "product",
|
||||
fields: ["id", "title", "handle", "status", "thumbnail"],
|
||||
fields: ["id", "title", "handle", "status", "thumbnail", "description", "metadata"],
|
||||
filters: { handle: [NEUE_SEIFE, ...FRUEHERE_HANDLES] },
|
||||
});
|
||||
|
||||
if (neue?.[0]) {
|
||||
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({
|
||||
input: {
|
||||
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,
|
||||
});
|
||||
logger.info(`Umbenannt in "${TITEL}".`);
|
||||
logger.info(`"${TITEL}": Text und Notiz aktualisiert.`);
|
||||
}
|
||||
if (produkt.thumbnail !== BILDER[0]) {
|
||||
await updateProductsWorkflow(container).run({
|
||||
@@ -166,7 +179,7 @@ export default async function ({ container }: any) {
|
||||
images: BILDER.map((url) => ({ url })),
|
||||
shipping_profile_id: profile?.[0]?.id,
|
||||
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],
|
||||
options: [{ title: "Größe", values: ["Standard"] }],
|
||||
variants: [
|
||||
|
||||
Reference in New Issue
Block a user