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(params: {
    product: Ref<Product> | Product;
    associationContext: "cross-selling" | "reviews";
}): IUseProductAssociations;

# Parameters

Parameter Type Description
params { product: Ref<Product> | Product; associationContext: "cross-selling" | "reviews"; }

Returns:

IUseProductAssociations

# Example

Example of possibilities:

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