Get-ShopifyMetafield #
ÜBERSICHT #
Liest ein einzelnes Metafield eines Shopify-Objekts per GraphQL.
SYNTAX #
Get-ShopifyMetafield [-Shop] <string> [-Token] <string> [-ApiVersion] <string> [-OwnerGid] <string>
[-Namespace] <string> [-Key] <string> [[-MaxRetries] <int>] [[-TimeoutSec] <int>]
[<CommonParameters>]
BESCHREIBUNG #
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.
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’.
-OwnerGid #
Type: string
Global ID des Besitzer-Objekts, z.B. ‘gid://shopify/Product/123’.
-Namespace #
Type: string
Namespace des Metafields, z.B. ’eulanda'.
-Key #
Type: string
Schlüssel des Metafields, z.B. ‘source’.
-MaxRetries #
Type: int
Default: 3
Maximale Anzahl Wiederholungen bei Rate-Limit.
-TimeoutSec #
Type: int
Default: 60
HTTP Timeout in Sekunden.
AUSGABEN #
pscustomobject -- Metafield-Objekt mit id, namespace, key, value, type oder $null.
BEISPIELE #
$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)" }