Skip to content
Shopware

useProductAssociations

useProductAssociations

Category:
Product

Get product association entity.

Types

ts
export function useProductAssociations(
  product: ComputedRef<Schemas["Product"]>,
  options: {
    associationContext: "cross-selling" | "reviews";
  },
): UseProductAssociationsReturn

source code

ts
export type UseProductAssociationsReturn = {
  /**
   * Start loading resources. Search Parameters and HTTP method can be passed.
   *
   */
  loadAssociations(params: {
    method?: "post" | "get";
    searchParams: Schemas["Criteria"];
  }): Promise<void>;
  /**
   * If it's loading - indicator
   */
  isLoading: ComputedRef<boolean>;
  /**
   * Product associations, like CrossSelling[]
   */
  productAssociations: ComputedRef<Schemas["CrossSellingElementCollection"]>;
};

source code