> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Importing products from Zuora into Stigg

Stigg provides a script (based on GraphQL queries) that imports products from Zuora into Stigg.

This script imports product catalog data from Zuora into Stigg by connecting to the Stigg GraphQL API and converting Zuora products, rate plans, and charges into Stigg products, plans, add-ons, and prices. It is designed to simplify catalog synchronization and ensure your Stigg environment accurately reflects your Zuora configuration.

All Zuora products listed in `ZUORA_PRODUCT_IDS` are consolidated into a single Stigg product. The first product becomes the main product entry; all plans and add-ons from every additional product are assigned to it. Zuora rate plans are converted into Stigg plans and add-ons, with add-ons automatically detected based on naming conventions such as `add-on` or `addon`. Only flat-rate and per-unit (imported as flat-fee) pricing models are supported. All created entities are saved as drafts by default, with the option to publish them as part of the workflow.

If a product or package with the same `refId` already exists in Stigg and is archived, the script will automatically unarchive it during import.

<Steps>
  <Step title="Clone the import script repository">
    Clone the repository that contains the Zuora-to-Stigg catalog import script:

    ```
    git clone https://github.com/stiggio/import-scripts
    cd import-catalog-from-zuora
    ```
  </Step>

  <Step title="Set up your environment and credentials">
    Use the provided `.env.example` file as a template:

    ```
    cp .env.example .env
    ```

    Update the values in `.env` with your Stigg credentials and Zuora configuration:

    ```
    X_API_KEY=your-stigg-api-server-key
    ENVIRONMENT_ID=your-stigg-environment-id
    ZUORA_PRODUCT_IDS=zuoraProductId1,zuoraProductId2
    ```

    * `ZUORA_PRODUCT_IDS` accepts a comma-separated list of Zuora product IDs.
  </Step>

  <Step title="Install dependencies">
    Install the required dependencies:

    ```
    yarn install
    ```
  </Step>

  <Step title="Run the default import">
    Run the script without any flags to perform a basic import:

    ```
    yarn run zuora-import
    ```

    This mode:

    * Creates new entities only
    * Does not update existing entities
    * Creates all entities in **Draft** status
  </Step>

  <Step title="Update existing entities (optional)">
    To update existing products, plans, and prices in Stigg, run the script with the `--update` flag:

    ```
    yarn run zuora-import --update
    ```

    This mode:

    * Creates new entities if they don’t exist
    * Updates existing entities
    * Does not publish any entities
  </Step>

  <Step title="Publish imported entities (optional)">
    To automatically publish all unpublished entities after import, use the `--publish` flag:

    ```
    yarn run zuora-import --publish
    ```

    This mode:

    * Creates new entities if they don’t exist
    * Publishes all unpublished entities
    * Does not update existing published entities
  </Step>

  <Step title="Update and publish in one run (optional)">
    You can combine update and publish behavior in a single run:

    ```
    yarn run zuora-import --update --publish
    ```

    This mode:

    * Creates new entities
    * Updates existing entities
    * Publishes all unpublished entities
  </Step>

  <Step title="Preview changes with dry-run mode">
    Use the `--dry-run` flag with any command to preview changes without modifying Stigg:

    ```
    yarn run zuora-import --dry-run
    yarn run zuora-import --update --dry-run
    yarn run zuora-import --publish --dry-run
    yarn run zuora-import --update --publish --dry-run
    ```

    In dry-run mode:

    * No changes are applied to Stigg
    * All planned actions are logged to the console for review
  </Step>

  <Step title="Freeze a plan with grandfathered forking (optional)">
    To preserve an existing plan or add-on as-is while the next import creates a fresh copy, run the fork command with the entity's `refId`:

    ```
    yarn run zuora-import:fork <plan-or-addon-refId>
    ```

    This marks the entity as grandfathered (`GRANDFATHERED: true` in its metadata). On the next import the script will:

    * Create a new plan or add-on with a `-copy-1` suffix (e.g. `Pro_Plan-copy-1`)
    * Copy all entitlements from the grandfathered entity to the new one
    * Leave the grandfathered entity untouched

    You can repeat this process — suffixes increment automatically (`-copy-1`, `-copy-2`, and so on). See [Import my Zuora catalog into Stigg](/documentation/native-integrations/billing/zuora/import-zuora-catalog-into-stigg#grandfathered-plan-forking) for more details.
  </Step>
</Steps>
