Home > @shopware-pwa/composables > useProductAssociations

# useProductAssociations() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Get product association entity. Options - IUseProductAssociations

Signature:

export declare function useProductAssociations(rootContext: ApplicationVueContext, product: Product, association: "cross-selling" | "reviews"): IUseProductAssociations;

# Parameters

Parameter Type Description
rootContext ApplicationVueContext
product Product
association "cross-selling" | "reviews"

Returns:

IUseProductAssociations

# Example

Example of possibilities:

const { loading, loadAssociations, productAssociations } = useProductAssociation(root, product, "cross-selling")
if (!productAssociations.value) {
   await loadAssociations()
}