The InstantProducts controller allows the end user to manage instant products queries.

interface InstantProducts {
    state: InstantProductsState;
    clearExpired(): void;
    interactiveProduct(props: InteractiveProductProps): InteractiveProduct;
    promoteChildToParent(child: ChildProduct): void;
    subscribe(listener: () => void): Unsubscribe;
    updateQuery(query: string): void;
}

Hierarchy (View Summary)

Methods

  • Finds the specified parent product and the specified child product of that parent, and makes that child the new parent. The children and totalNumberOfChildren properties of the original parent are preserved in the new parent.

    This method is useful when leveraging the product grouping feature to allow users to select nested products.

    E.g., if a product has children (such as color variations), you can call this method when the user selects a child to make that child the new parent product, and re-render the product as such in the storefront.

    Note: In the controller state, a product that has children will always include itself as its own child so that it can be rendered as a nested product, and restored as the parent product through this method as needed.

    Parameters

    • child: ChildProduct

      The child product that will become the new parent.

    Returns void

Properties

The state of the InstantProducts controller.