Skip to main content

Function: productService()

productService(client): object

Defined in: service/ProductService.ts:90

Service class for Product-related GraphQL operations

Parameters

client

GraphQLClient

Returns

addSurchargesToProduct()

addSurchargesToProduct(input): Promise<ConfirmationResponse>

Adds surcharges to a product *

Parameters

input

AddSurchargesToProductInput

Surcharges input data *

Returns

Promise<ConfirmationResponse>

Promise<boolean> Success status

createProduct()

createProduct(input): Promise&lt;Product>

Creates a new product *

Parameters

input

CreateProductInput

Product creation input data *

Returns

Promise&lt;Product>

Promise<Product> The created product

getAttributeResultByProductId()

getAttributeResultByProductId(productId, input): Promise&lt;AttributeResultResponse>

Fetches attribute results for a product *

Parameters

productId

number

Product ID *

input

AttributeResultSearchInput

Attribute result search input *

Returns

Promise&lt;AttributeResultResponse>

Promise<AttributeResultResponse> The attribute result response

getAttributesByProductId()

getAttributesByProductId(productId, input): Promise&lt;AttributeResponse>

Fetches attributes for a product *

Parameters

productId

number

Product ID *

input

AttributeSearchInput

Attribute search input *

Returns

Promise&lt;AttributeResponse>

Promise<AttributeResponse> The attributes response

getProduct()

getProduct(variables, fetchOptions?): Promise&lt;Product>

Fetches a single product by ID, slug, or SKU *

Parameters

variables

ProductQueryVariables

input variables for aproduct to fetch

    • productId: int - Product ID to fetch
    • slug: string - Product slug to fetch
    • sku: string - Product SKU to fetch
    • language: string - Language for localized content
    • applyOrderlists: boolean - Whether to apply orderlist logic
    • orderlistIds: number[] - Array of orderlist IDs to apply
    • priceCalculateProductInput: PriceCalculateProductInput - Price calculation input
    • userBulkPriceProductInput: UserBulkPriceProductInput - User bulk price input
    • attributeResultSearchInput: AttributeResultSearchInput - Attribute search input
    • imageSearchFilters: MediaImageProductSearchInput - Image search filters
    • mediaVideoSearchInput: MediaVideoProductSearchInput - Video search input
    • mediaDocumentSearchInput: MediaDocumentProductSearchInput - Document search input
    • imageVariantFilters: TransformationsInput - Image transformation filters
fetchOptions?

GraphQLFetchOptions

Returns

Promise&lt;Product>

Promise<Product> The product data

getProducts()

getProducts(variables): Promise&lt;ProductsResponse>

Fetches a list of products with search criteria *

Parameters

variables

ProductsQueryVariables

    • input: ProductSearchInput - Product search input parameters
    • language: string - Language for localized content
    • priceCalculateProductInput: PriceCalculateProductInput - Price calculation input
    • imageSearchFilters: MediaImageProductSearchInput - Image search filters
    • imageVariantFilters: TransformationsInput - Image transformation filters
    • filterAvailableAttributeInput: FilterAvailableAttributeInput - Filter available attributes input

Returns

Promise&lt;ProductsResponse>

Promise<ProductsResponse> The products response data

getProductSurcharges()

getProductSurcharges(productId): Promise&lt;SurchargeProductResponse>

Fetches surcharges for a product *

Parameters

productId

number

Product ID *

Returns

Promise&lt;SurchargeProductResponse>

Promise<SurchargesResponse> The surcharges response

importProductsCsv()

importProductsCsv(input): Promise&lt;CsvImportResponse>

Imports products from CSV *

Parameters

input

ProductCsvInput

CSV import input data *

Returns

Promise&lt;CsvImportResponse>

Promise<CsvImportResponse> The import response

updateProduct()

updateProduct(variables): Promise&lt;Product>

Updates an existing product *

Parameters

variables

ProductUpdateVariables

ProductUpdateVariables update input data

    • productId: number - ID of the product to update
    • input: UpdateProductInput - The fields to update for the product

Returns

Promise&lt;Product>

Promise<Product> The updated product