EulandaXtools — Funktionsreferenz
Legt eine Metafield-Definition in Shopify an (idempotent).
Set-ShopifyMetafieldDefinition [-Shop] <string> [-Token] <string> [-ApiVersion] <string> [-Name]
<string> [-Namespace] <string> [-Key] <string> [-Type] <string> [-OwnerType] <string>
[[-Description] <string>] [[-CustomerAccountAccess] <bool>] [[-MaxRetries] <int>]
[[-TimeoutSec] <int>] [<CommonParameters>]Erstellt eine Metafield-Definition über die GraphQL Admin API. Wenn die Definition bereits existiert (Code TAKEN), wird kein Fehler geworfen, sondern ein Ergebnis mit AlreadyExists = $true zurückgegeben.
Optional kann der Zugriff für Kundenkonten aktiviert werden (CustomerAccountAccess), damit Metafield-Werte auf der Bestellstatus-Seite sichtbar sind.
-Shop
Type: stringShopify-Shop-Domain, z.B. 'mein-shop.myshopify.com'.
-Token
Type: stringAdmin API Access Token (shpat_...) der Custom App.
-ApiVersion
Type: stringAPI-Version, z.B. '2025-01'.
-Name
Type: stringAnzeigename der Metafield-Definition.
-Namespace
Type: stringNamespace des Metafields, z.B. 'custom'.
-Key
Type: stringSchlüssel des Metafields, z.B. 'invoice_pdf'.
-Type
Type: stringDatentyp, z.B. 'file_reference', 'single_line_text_field'.
-OwnerType
Type: stringRessourcentyp: ORDER, PRODUCT, CUSTOMER oder COLLECTION.
-Description
Type: string
Default: ''Optionale Beschreibung der Definition.
-CustomerAccountAccess
Type: bool
Default: $falseWenn $true, wird der Lesezugriff für Kundenkonten aktiviert.
-MaxRetries
Type: int
Default: 3Maximale Anzahl Wiederholungen bei Rate-Limit.
-TimeoutSec
Type: int
Default: 60HTTP Timeout in Sekunden.
pscustomobject -- Objekt mit Id, Name, Namespace, Key, AlreadyExists.Set-ShopifyMetafieldDefinition -Shop 'mein-shop.myshopify.com' `
-Token 'shpat_abc123' -ApiVersion '2025-01' `
-Name 'Rechnung PDF' -Namespace 'custom' -Key 'invoice_pdf' `
-Type 'file_reference' -OwnerType 'ORDER' -CustomerAccountAccess $true