# Recipes

> Copy-ready Shoplazza CLI snippets that chain commands with --jq: export product IDs, count open orders, preview a bulk discount, and run unattended in CI.

Copy-ready snippets that combine multiple commands for common tasks. All rely on the default JSON output and `--jq` filtering.

## Export all product IDs

```shell
shoplazza products list --jq '.data.products[].id'
```

## Chain: get details for each product

stdout is safe to pipe, so you can feed IDs into another command:

```shell
shoplazza products list --jq '.data.products[].id' \
  | xargs -I {} shoplazza products get --id {}
```

## Count open orders

```shell
shoplazza orders +count --jq '.data.count'
```

## Preview a bulk discount before creating it

```shell
shoplazza discounts +rebate --target order --tiers "200:20,500:50,1000:120" --dry-run
```

## Create a customer and capture the new ID

```shell
shoplazza customers +create --email test@example.com --jq '.data.id'
```

## Search with a table view for quick scanning

```shell
shoplazza orders +search --fields "id,status,total_price" --format table
```

## Non-interactive run in CI

```shell
export SHOPLAZZA_UAT=your-token
export SHOPLAZZA_STORE=my-store.myshoplaza.com
shoplazza products +search --keyword "shirt" --jq '.data.products | length'
```

## See also

* [Output formats](./output-formats)
* [Pagination & filtering](./pagination-and-filtering)
* [CI/CD integration](./ci-cd)
