> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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/stores/catalog-v3/promotions-v3/sample-flows.md

## Article Content:

# Promotions: Sample Flows

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

## Sync promotions to an external content management system

If a site owner manages promotional content in an external system, you can periodically export new and updated promotions to keep both systems in sync.

To sync promotions to an external system:

1. For the initial sync after the app is installed, call [Query Promotions](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/promotions-v3/query-promotions.md) to retrieve all existing promotions.

1. Upload the returned promotions to the external system.

1. Save the current date and time to use as a reference for subsequent syncs.

1. For each subsequent sync, call [Query Promotions](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/promotions-v3/query-promotions.md) and filter for promotions updated since the last sync:

    ```json
    {
      "filter": {
        "updatedDate": {
          "$gt": "<LAST_SYNC_DATETIME>"
        }
      }
    }
    ```

1. Upload any new or updated promotions to the external system.

1. Repeat steps 4 and 5 at your desired interval. You can allow the site admin to configure the sync frequency through your app.

## Assign seasonal promotions to multiple categories

When a site owner runs a seasonal sale, you can create promotions and assign them to multiple categories at once using the bulk API.

To assign seasonal promotions to multiple categories:

1. Prepare an array of promotion objects, each with a `name`, `media`, and the `categories` to assign to. Set `appliedToSubcategories` to `true` if the promotion should also appear in subcategories. For example:

    ```json
    {
      "promotions": [
        {
          "name": "Summer Sale",
          "media": {
            "url": "https://example.com/summer-sale-banner.jpg"
          },
          "categories": [
            {
              "id": "<CATEGORY_ID>",
              "position": 1,
              "appliedToSubcategories": true
            }
          ],
          "enabled": true
        }
      ]
    }
    ```

1. Call [Bulk Create Promotions](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/promotions-v3/bulk-create-promotions.md) with the array and set `returnEntity` to `true` to get the created promotions in the response.

1. Verify that the promotions were created successfully by checking the `bulkActionMetadata.totalSuccesses` field in the response.

1. To verify how the promotions appear for a specific category, call [Resolve Promotions](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/promotions-v3/resolve-promotions.md) with the category ID. The response returns the effective promotions sorted by position.

    > **Note:** When media is set with a URL, Wix Media Manager imports the image asynchronously, and the promotion becomes enabled only after the import completes successfully. Until then, Resolve Promotions doesn't return the promotion.