EulandaXtools — Funktionsreferenz
Liest ein einzelnes Metafield eines Shopify-Objekts per GraphQL.
Get-ShopifyMetafield [-Shop] <string> [-Token] <string> [-ApiVersion] <string> [-OwnerGid] <string>
[-Namespace] <string> [-Key] <string> [[-MaxRetries] <int>] [[-TimeoutSec] <int>]
[<CommonParameters>]Ruft per GraphQL Admin API ein Metafield anhand von Owner-GID, Namespace und Key ab. Unterstützt Product, Order und Collection als Owner-Typen.
Ersetzt die bisherigen Inline-REST-Calls in Consumer-Scripts, die per GET /products/{id}/metafields.json einzelne Metafields abgefragt haben.
Gibt das Metafield-Objekt zurück oder $null, wenn kein Metafield mit dem angegebenen Namespace/Key existiert.
-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'.
-OwnerGid
Type: stringGlobal ID des Besitzer-Objekts, z.B. 'gid://shopify/Product/123'.
-Namespace
Type: stringNamespace des Metafields, z.B. 'eulanda'.
-Key
Type: stringSchlüssel des Metafields, z.B. 'source'.
-MaxRetries
Type: int
Default: 3Maximale Anzahl Wiederholungen bei Rate-Limit.
-TimeoutSec
Type: int
Default: 60HTTP Timeout in Sekunden.
pscustomobject -- Metafield-Objekt mit id, namespace, key, value, type oder $null.$mf = Get-ShopifyMetafield -Shop 'mein-shop.myshopify.com' `
-Token 'shpat_abc123' -ApiVersion '2025-01' `
-OwnerGid 'gid://shopify/Product/7654321098765' `
-Namespace 'eulanda' -Key 'source'
if ($null -ne $mf) { Write-Host "Wert: $($mf.value)" }