Set-ShopifyCollection

EulandaXtools — Funktionsreferenz

Set-ShopifyCollection

ÜBERSICHT

Legt eine Shopify Custom Collection an oder aktualisiert sie (Upsert per Title).

SYNTAX

Set-ShopifyCollection [-Shop] <string> [-Token] <string> [-ApiVersion] <string> [-Title] <string>
    [[-BodyHtml] <string>] [[-Published] <bool>] [[-Handle] <string>] [[-BreadcrumbPath] <string>]
    [[-CollectionId] <long>] [[-MaxRetries] <int>] [[-TimeoutSec] <int>] [<CommonParameters>]

BESCHREIBUNG

Prüft über Get-ShopifyCollectionList, ob bereits eine Collection mit dem angegebenen Title existiert. Falls ja, wird eine collectionUpdate-Mutation ausgeführt, andernfalls eine collectionCreate-Mutation (GraphQL Admin API).

Optional wird ein Metafield 'eulanda.breadcrumb_path' gesetzt, das den vollständigen EULANDA-Merkmalbaum-Pfad speichert.

EULANDA-Merkmalbaum-Knoten werden flach (eine Ebene unter dem Hauptmerkmal) als Shopify Custom Collections abgebildet. Shopify unterstützt keine hierarchischen Collections. Der Sonderfall Title='Startseite' sollte mit Handle='frontpage' angelegt werden (Shopify Featured Collection für die Homepage).

PARAMETER

-Shop

Type: string

Shopify-Shop-Domain, z.B. 'mein-shop.myshopify.com'.

-Token

Type: string

Admin API Access Token (shpat_...) der Custom App.

-ApiVersion

Type: string

API-Version, z.B. '2025-01'.

-Title

Type: string

Name der Collection (wird als Lookup-Schlüssel für Upsert verwendet).

-BodyHtml

Type: string
Default: ''

Optionale HTML-Beschreibung der Collection.

-Published

Type: bool
Default: $true

Ob die Collection veröffentlicht werden soll. Standard: $true.

-Handle

Type: string

Optionaler URL-freundlicher Name (Slug). Spezialfall: 'frontpage' für Homepage.

-BreadcrumbPath

Type: string

Optionaler EULANDA-Merkmalbaum-Pfad, wird als Metafield gespeichert.

-CollectionId

Type: long

Optionale Shopify-Collection-ID. Wenn angegeben, wird direkt aktualisiert ohne vorherige Suche.

-MaxRetries

Type: int
Default: 3

Maximale Anzahl Wiederholungen bei Rate-Limit.

-TimeoutSec

Type: int
Default: 60

HTTP Timeout in Sekunden.

AUSGABEN

pscustomobject

BEISPIELE

# Neue Collection anlegen
Set-ShopifyCollection -Shop 'mein-shop.myshopify.com' `
  -Token 'shpat_abc123' -ApiVersion '2025-01' `
  -Title 'NPK Dünger' -BreadcrumbPath '\Shop\Düngemittel\NPK Dünger'
# Bestehende Collection aktualisieren
Set-ShopifyCollection -Shop $shop -Token $token -ApiVersion '2025-01' `
  -Title 'Schaufeln' -CollectionId 123456789