Set Shopify Metafield Definition
Zuletzt geändert: 14.03.2026 05:56

Set-ShopifyMetafieldDefinition #

ÜBERSICHT #

Legt eine Metafield-Definition in Shopify an (idempotent).

SYNTAX #

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>]

BESCHREIBUNG #

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.

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’.

-Name #

Type: string

Anzeigename der Metafield-Definition.

-Namespace #

Type: string

Namespace des Metafields, z.B. ‘custom’.

-Key #

Type: string

Schlüssel des Metafields, z.B. ‘invoice_pdf’.

-Type #

Type: string

Datentyp, z.B. ‘file_reference’, ‘single_line_text_field’.

-OwnerType #

Type: string

Ressourcentyp: ORDER, PRODUCT, CUSTOMER oder COLLECTION.

-Description #

Type: string
Default: ''

Optionale Beschreibung der Definition.

-CustomerAccountAccess #

Type: bool
Default: $false

Wenn $true, wird der Lesezugriff für Kundenkonten aktiviert.

-MaxRetries #

Type: int
Default: 3

Maximale Anzahl Wiederholungen bei Rate-Limit.

-TimeoutSec #

Type: int
Default: 60

HTTP Timeout in Sekunden.

AUSGABEN #

pscustomobject -- Objekt mit Id, Name, Namespace, Key, AlreadyExists.

BEISPIELE #

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