Blog

๐Ÿ›๏ธ De WooCommerce-integratie is gearriveerd bij Gato GraphQL!

Leonardo Losoviz
Door Leonardo Losoviz ยท

De WooCommerce-extensie is nu beschikbaar voor Gato GraphQL! ๐ŸŽ‰

WooCommerce-extensie voor Gato GraphQL
WooCommerce-extensie voor Gato GraphQL

Deze gloednieuwe extensie stelt ons in staat om gegevens op te halen uit WooCommerce, waaronder producten, bestellingen, klanten, kortingsbonnen, enz.


Hieronder vind je voorbeelden van queries om gegevens uit je WooCommerce-winkel op te halen.

Producten (Alle)

Deze query haalt alle producten op met hun basisinformatie:

query FetchAllProducts {
  woocommerceProducts {
    __typename
    id
    name
    slug
    url
    urlPath
    sku
    ...on WooCommercePriceableProductOrProductVariation {
      price
      priceFormatted
      regularPrice
      regularPriceFormatted
      salePrice
      salePriceFormatted
      onSale
    }
    status
    type
    featured
    totalSales
    averageRating
    ratingCount
    image {
      id
      src
      altText
      title
      caption
    }
    categories {
      id
      name
      slug
    }
    tags {
      id
      name
      slug
    }
    brands {
      id
      name
      slug
    }
  }
  woocommerceProductsCount
}

Producten (op Type)

Eenvoudige Producten

Deze query haalt alle eenvoudige producten op:

query FetchSimpleProducts {
  woocommerceSimpleProducts {
    __typename
    id
    name
    slug
    url
    urlPath
    sku
    description
    shortDescription
    price
    priceFormatted
    regularPrice
    regularPriceFormatted
    salePrice
    salePriceFormatted
    onSale
    status
    type
    featured
    totalSales
    averageRating
    ratingCount
    image {
      id
      src
      altText
      title
      caption
    }
    categories {
      id
      name
      slug
    }
    tags {
      id
      name
      slug
    }
    brands {
      id
      name
      slug
    }
    # Stock management fields
    manageStock
    stockQuantity
    stockStatus
    backorders
    backordersAllowed
    backordered
    soldIndividually
    lowStockThreshold
    # Shipping fields
    isVirtual
    weight
    length
    width
    height
    dimensions
    shippingClassID
    shippingClass {
      id
      name
      slug
      description
      count
    }
    # Downloadable fields
    isDownloadable
    downloadLimit
    downloadExpiry
    downloads
    downloadsCount
    # Tax fields
    taxStatus
    taxClass
    # Cross-sell fields
    crossSellIDs
    crossSells {
      id
      name
      slug
      sku
    }
  }
  woocommerceSimpleProductsCount
}

Externe Producten

Deze query haalt alle externe producten op:

query FetchExternalProducts {
  woocommerceExternalProducts {
    __typename
    id
    name
    slug
    url
    urlPath
    sku
    description
    shortDescription
    price
    priceFormatted
    regularPrice
    regularPriceFormatted
    salePrice
    salePriceFormatted
    onSale
    status
    type
    featured
    totalSales
    averageRating
    ratingCount
    image {
      id
      src
      altText
      title
      caption
    }
    categories {
      id
      name
      slug
    }
    tags {
      id
      name
      slug
    }
    brands {
      id
      name
      slug
    }
    # External product specific fields
    externalURL
    buttonText
    # Tax fields
    taxStatus
    taxClass
  }
  woocommerceExternalProductsCount
}

Gegroepeerde Producten

Deze query haalt alle gegroepeerde producten op:

query FetchGroupProducts {
  woocommerceGroupProducts {
    __typename
    id
    name
    slug
    url
    urlPath
    sku
    description
    shortDescription
    status
    type
    featured
    totalSales
    averageRating
    ratingCount
    image {
      id
      src
      altText
      title
      caption
    }
    categories {
      id
      name
      slug
    }
    tags {
      id
      name
      slug
    }
    brands {
      id
      name
      slug
    }
    # Group product specific fields
    hasChildren
    childrenCount
    minPrice
    maxPrice
    minPriceFormatted
    maxPriceFormatted
    children {
      id
      name
      slug
      sku
    }
  }
  woocommerceGroupProductsCount
}

Variabele Producten

Deze query haalt alle variabele producten op:

query FetchVariableProducts {
  woocommerceVariableProducts {
    __typename
    id
    name
    slug
    url
    urlPath
    sku
    description
    shortDescription
    status
    type
    featured
    totalSales
    averageRating
    ratingCount
    image {
      id
      src
      altText
      title
      caption
    }
    categories {
      id
      name
      slug
    }
    tags {
      id
      name
      slug
    }
    brands {
      id
      name
      slug
    }
    # Variable product specific fields
    hasVariations
    variationsCount
    minPrice
    maxPrice
    minRegularPrice
    maxRegularPrice
    minSalePrice
    maxSalePrice
    priceRange
    variations {
      id
      name
      slug
      sku
    }
    defaultAttributes {
      taxonomy
      termSlug
      termObject {
        id
        name
        slug
      }
    }
    # Cross-sell fields
    crossSellIDs
    crossSells {
      id
      name
      slug
      sku
    }
    # Tax fields
    taxStatus
    taxClass
  }
  woocommerceVariableProductsCount
}

Klanten

Deze query haalt alle klanten op:

query FetchCustomers {
  woocommerceCustomers {
    __typename
    id
    username
    email
    firstName
    lastName
    displayName
    description
    createdDate
    createdDateStr
    formattedCreatedDateStr: createdDateStr(format: "d/m/Y H:i:s")
    modifiedDate
    modifiedDateStr
    formattedModifiedDateStr: modifiedDateStr(format: "d/m/Y H:i:s")
    role
    billing
    shipping
    isPayingCustomer
    avatarURL
    totalSpent
    totalSpentFormatted
    orderCount
    lastOrderID
    lastOrder {
      id
      orderNumber
      status
      total
      date
    }
    orders {
      id
      orderNumber
      status
      total
      date
    }
    ordersCount
  }
  woocommerceCustomersCount
}

Bestellingen

Deze query haalt alle bestellingen op:

query FetchOrders {
  woocommerceOrders {
    __typename
    id
    orderNumber
    orderKey
    date
    modifiedDate
    dateStr
    formattedDateStr: dateStr(format: "d/m/Y H:i:s")
    modifiedDateStr
    formattedModifiedStr: modifiedDateStr(format: "d/m/Y H:i:s")
    status
    isPaid
    currency
    total
    totalFormatted
    subtotal
    subtotalFormatted
    totalTax
    totalTaxFormatted
    totalShipping
    totalShippingFormatted
    totalDiscount
    totalDiscountFormatted
    totalDiscountTax
    totalDiscountTaxFormatted
    shippingTotal
    shippingTotalFormatted
    shippingTax
    shippingTaxFormatted
    cartTax
    cartTaxFormatted
    totalFee
    totalFeeFormatted
    customerID
    customer {
      id
      username
      email
      firstName
      lastName
      displayName
    }
    customerNote
    billingAddress
    shippingAddress
    hasCompletedStatus: hasStatus(status: "completed")
    hasPendingStatus: hasStatus(status: "pending")
    hasProcessingStatus: hasStatus(status: "processing")
    hasOnHoldStatus: hasStatus(status: "on-hold")
    hasCancelledStatus: hasStatus(status: "cancelled")
    hasRefundedStatus: hasStatus(status: "refunded")
    hasFailedStatus: hasStatus(status: "failed")
    hasAnyCompletedOrProcessingStatus: hasAnyStatus(statuses: ["completed", "processing"])
    hasAnyPendingOrOnHoldStatus: hasAnyStatus(statuses: ["pending", "on-hold"])
    paymentMethod
    paymentMethodTitle
    transactionID
    datePaid
    datePaidStr
    formattedDatePaidStr: datePaidStr(format: "d/m/Y H:i:s")
    dateCompleted
    dateCompletedStr
    formattedDateCompletedStr: dateCompletedStr(format: "d/m/Y H:i:s")
    cartHash
    newOrderEmailSent
    orderCurrency
    orderVersion
    pricesIncludeTax
    discountTotal
    discountTax
    refunded
    remainingRefundAmount
    itemCount
    items {
      id
      name
      quantity
      subtotal
      subtotalFormatted
      total
      totalFormatted
      totalTax
      totalTaxFormatted
      productID
      variationID
      reducedStockNumber
      product {
        id
        name
        slug
        sku
      }
      variation {
        id
        name
        slug
        sku
      }
    }
    refunds {
      id
      amount
      amountFormatted
      reason
      status
    }
    downloadPermissionsGranted
    needsPayment
    needsProcessing
    isDownloadPermitted
    hasDownloadableItem
  }
  woocommerceOrdersCount
}

Terugbetalingen

Deze query haalt alle terugbetalingen op:

query FetchRefunds {
  woocommerceRefunds {
    __typename
    id
    orderID
    order {
      id
      orderNumber
      status
    }
    amount
    amountFormatted
    reason
    refundedBy {
      id
      name
      email
    }
    isPaymentRefundedViaAPI
    refundType
    date
    modifiedDate
    dateStr
    formattedDateStr: dateStr(format: "d/m/Y H:i:s")
    modifiedDateStr
    formattedModifiedDateStr: modifiedDateStr(format: "d/m/Y H:i:s")
    status
  }
  woocommerceRefundsCount
}

Beoordelingen

Deze query haalt alle productbeoordelingen op:

query FetchProductReviews {
  woocommerceReviews {
    __typename
    id
    content
    author
    authorEmail
    rating
    verified
    approved
    date
    dateStr
    productID
    product {
      id
      name
    }
  }
  woocommerceReviewsCount
}

Kortingsbonnen

Deze query haalt alle kortingsbonnen op:

query FetchCoupons {
  woocommerceCoupons {
    __typename
    id
    code
    amount
    amountFormatted
    dateExpires
    dateExpiresStr
    formattedDateExpiresStr: dateExpiresStr(format: "d/m/Y H:i:s")
    discountType
    description
    date
    modifiedDate
    dateStr
    formattedDateStr: dateStr(format: "d/m/Y H:i:s")
    modifiedDateStr
    formattedModifiedDateStr: modifiedDateStr(format: "d/m/Y H:i:s")
    usageCount
    individualUse
    productIDs
    products {
      id
      name
      slug
    }
    productsCount
    excludedProductIDs
    excludedProducts {
      id
      name
      slug
    }
    excludedProductsCount
    usageLimit
    usageLimitPerUser
    limitUsageToXItems
    freeShipping
    productCategoryIDs
    productCategories {
      id
      name
      slug
    }
    productCategoriesCount
    excludedProductCategoryIDs
    excludedProductCategories {
      id
      name
      slug
    }
    excludedProductCategoriesCount
    productBrandIDs
    productBrands {
      id
      name
      slug
    }
    productBrandsCount
    excludedProductBrandIDs
    excludedProductBrands {
      id
      name
      slug
    }
    excludedProductBrandsCount
    excludeSaleItems
    minimumAmount
    minimumAmountFormatted
    maximumAmount
    maximumAmountFormatted
    emailRestrictions
    usedByCustomerIDs
    usedByCustomers {
      id
      username
      email
      firstName
      lastName
      displayName
    }
    usedByCustomersCount
  }
  woocommerceCouponsCount
}

En Meer

Meer voorbeelden vind je in de volgende bronnen:


Abonneer je op onze nieuwsbrief

Blijf op de hoogte van alle updates over Gato GraphQL.