Set-ShopifyProduct

EulandaXtools — Funktionsreferenz

Set-ShopifyProduct

ÜBERSICHT

Legt ein Shopify-Produkt an oder aktualisiert es (Upsert per SKU).

SYNTAX

Set-ShopifyProduct [-Shop] <string> [-Token] <string> [-ApiVersion] <string> [-Product] <hashtable>
    [[-MaxRetries] <int>] [[-TimeoutSec] <int>] [<CommonParameters>]

BESCHREIBUNG

Prüft über Get-ShopifyProduct, ob bereits ein Produkt mit der angegebenen SKU existiert. Falls ja, wird es aktualisiert, andernfalls neu angelegt (productSet Mutation, GraphQL Admin API).

Die Eingabe-Hashtable verwendet REST-kompatible Feldnamen (body_html, product_type), die intern auf GraphQL-Felder gemappt werden.

Das Ergebnis wird in ein REST-kompatibles Format normalisiert: GIDs werden in numerische IDs umgewandelt, edges in flache Arrays.

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

-Product

Type: hashtable

Hashtable mit den Produktdaten. Muss mindestens eine Variante mit SKU enthalten. Beispiel: @{ title = 'Testartikel' body_html = '

Beschreibung

' vendor = 'EULANDA' variants = @(@{ sku = '1100'; price = '19.99' }) }

-MaxRetries

Type: int
Default: 3

Maximale Anzahl Wiederholungen bei Rate-Limit.

-TimeoutSec

Type: int
Default: 60

HTTP Timeout in Sekunden.

AUSGABEN

pscustomobject

BEISPIELE

# Produkt anlegen oder aktualisieren
$product = @{
  title     = 'Grundmodul 1100'
  body_html = '<p>Das Standard-Grundmodul</p>'
  vendor    = 'EULANDA'
  variants  = @(@{ sku = '1100'; price = '29.99' })
}
Set-ShopifyProduct -Shop 'mein-shop.myshopify.com' `
  -Token 'shpat_abc123' -ApiVersion '2025-01' -Product $product
# Preis aktualisieren (Produkt existiert bereits)
$product = @{
  title    = 'Grundmodul 1100'
  variants = @(@{ sku = '1100'; price = '39.99' })
}
Set-ShopifyProduct -Shop $shop -Token $token -ApiVersion '2025-01' -Product $product