> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/related-products/sample-flows.md

## Article Content:

# Related Products API: Sample Flows

This article presents a possible use case and corresponding sample flow that you can support. It provides a useful starting point as you plan your implementation.

## Show related products on a booking page

When a customer views a service or books it, you can show the products the business linked to the service,
for example a yoga mat next to a yoga class.

To show related products for the services on a page:

1. Collect the IDs of the services on the page, up to 100.

2. Call [List Related Products By Service IDs](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/related-products/list-related-products-by-service-ids.md) with the service IDs, and set `includeProducts` to `true`:

    ```json
    {
      "serviceIds": ["<SERVICE_ID_1>", "<SERVICE_ID_2>"],
      "includeProducts": true
    }
    ```

3. For each service, find its related products settings in `relatedProducts` by `serviceId`.
   If a service has no entry, it has no related products. Don't show the section for it.

4. For each service, select the products in `productSummaries` whose `tags.publicTagIds` or `tags.privateTagIds`
   include any of the service's `productTagIds`.

5. Display each product card:
    - Show `name`, `media`, and `ribbon`.
    - Show `price` as the product's price. If `compareAtPrice.value` is higher than `price.value`,
      show `compareAtPrice` with a strikethrough.
    - If `discountInfo.discountRuleNames` isn't empty, show `variantSummary.minPriceVariant.priceAfterDiscount`
      as the discounted price.
    - Use `availabilityStatus` to mark products that are out of stock.

6. When a customer selects a product:
    - If `optionsOrModifiersSupported` is `true`, send the customer to the product page at `url` to choose options.
    - Otherwise, you can offer a direct "buy" action.

7. If `pagingMetadata.hasNext` is `true` and you want to show more products,
   call [List Related Products By Service IDs](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/related-products/list-related-products-by-service-ids.md) again with the same `serviceIds`,
   and specify `pagingMetadata.cursors.next` as `cursorPaging.cursor`.