Zum Hauptinhalt springen

Übersicht

Greife auf die öffentlichen Informationen deines Shops zu, einschließlich Name, Beschreibung, Logo, Banner und Währungseinstellungen.

Shop-Details abrufen

Rufe vollständige Informationen über deinen Shop ab.
const response = await komerza.getStore();

Rückgabe

Gibt ApiResponse<Store> zurück:
interface Store {
  id: string; // Shop-Bezeichner
  name: string; // Shop-Name
  description: string; // Shop-Beschreibung (unterstützt Markdown)
  url: string; // Shop-Subdomain
  customDomain?: string; // Benutzerdefinierte Domain, falls gesetzt
  currencyCode: string; // ISO 4217 Währungscode (z. B. "USD")
  domain: string; // Vollständige Domain
  rating: number; // Durchschnittliche Shop-Bewertung
  maintenanceReason?: string; // Falls Shop im Wartungsmodus
  branding?: {
    iconFileName?: string; // Logo-Dateiname
    bannerFileName?: string; // Banner-Dateiname
    accentColor?: string; // Shop-Akzentfarbe
    isAutomaticCurrencyConversionEnabled?: boolean;
  };
  products: ProductReference[]; // Produktliste
  categories: Category[]; // Kategorienliste
  affiliateOptions?: {
    isEnabled: boolean;
    defaultReturnPercentage: number;
    defaultPercentageOff: number;
    canConvertAffiliateBalance: boolean;
    isPublicRegistrationEnabled: boolean;
    isLinkEditingEnabled: boolean;
  };
  dateCreated: string; // ISO 8601 Zeitstempel
}

interface Category {
  id: string;
  name: string;
  slug: string;
  visibility: number;
  order: number;
  storeId: string;
  productCount: number;
  products: string[]; // Liste der Produkt-IDs
  dateCreated: string;
}

Beispiel

// Shop-Informationen anzeigen
async function shopInfoAnzeigen() {
  const response = await komerza.getStore();

  if (response.success) {
    const store = response.data;

    document.getElementById("store-name").textContent = store.name;
    document.getElementById("store-description").textContent =
      store.description;
    document.getElementById("product-count").textContent =
      `${store.products.length} Produkte`;

    console.log(`Shop verwendet die Währung ${store.currencyCode}`);
  }
}

Shop-Logo abrufen

Rufe die URL zum Logo-Bild deines Shops ab.
const logoUrl = await komerza.getStoreLogoUrl();

Rückgabe

Gibt einen String zurück, der die vollständige URL zum Logo-Bild enthält.

Beispiel

// Shop-Logo anzeigen
async function logoAnzeigen() {
  const logoUrl = await komerza.getStoreLogoUrl();

  const img = document.createElement("img");
  img.src = logoUrl;
  img.alt = "Shop-Logo";
  document.getElementById("logo-container").appendChild(img);
}

Shop-Banner abrufen

Rufe die URL zum Banner-Bild deines Shops ab.
const bannerUrl = await komerza.getStoreBannerUrl();