# products

> Shoplazza CLI products commands: shortcuts for search, pricing, and stock changes, plus API commands for variants, images, collections, and inventory.

Manage products, variants, images, collections, inventory, and more. Includes 9 shortcut commands and 79 API commands.

## Shortcuts

### +search

Search products by title, publish status, vendor, or collection. Returns one page; follow `has_more`/`cursor` for the rest.

```shell
shoplazza products +search [flags]
```

| Flag | Type | Description |
|------|------|-------------|
| `--keyword` | string | Filter by product title |
| `--published` | string | Filter by publish status: `published`, `unpublished`, or `any` (`true`/`false` also accepted) |
| `--vendor` | string | Filter by vendor name (exact match) |
| `--collection-id` | string | Filter by collection ID |
| `--page-limit` | int | Page size (1–250) |
| `--fields` | string | Return fields (comma-separated; unknown names are ignored) |

```shell
shoplazza products +search --keyword "T-shirt"
shoplazza products +search --published published --vendor "Nike"
shoplazza products +search --collection-id 123
shoplazza products +search --page-limit 50 --fields "id,title,variants"
```

### +count

Count products, optionally filtered by publish status.

```shell
shoplazza products +count [flags]
```

| Flag | Type | Description |
|------|------|-------------|
| `--published` | string | Filter by publish status: `published`, `unpublished`, or `any` (`true`/`false` also accepted) |

```shell
shoplazza products +count
shoplazza products +count --published published
```

### +create

Create a new product with smart defaults.

```shell
shoplazza products +create [flags]
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--title` | string | Yes | Product title |
| `--price` | string | Yes | Price (e.g. `29.99`) |
| `--image` | string | Yes | Image URL |
| `--compare-price` | string | | Compare-at price |
| `--sku` | string | | SKU |
| `--stock` | int | | Stock quantity (enables inventory tracking) |
| `--stock-policy` | string | | Policy when stock is 0: `continue`, `deny`, or `auto_unpublished` (default: `deny`) |
| `--tags` | string | | Tags (comma-separated) |
| `--published` | bool | | Publish immediately (default: draft) |
| `--collection-ids` | string | | Collection IDs to add to |

```shell
shoplazza products +create --title "My Product" --price 29.99 --image "https://example.com/img.jpg"
shoplazza products +create --title "My Product" --price 29.99 --image "https://..." \
  --compare-price 39.99 --sku SKU001 --stock 100 --tags "new,featured" --published
```

### +publish

Publish a product to the online store.

```shell
shoplazza products +publish --id <product-id>
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--id` | string | Yes | Product ID (in an interactive terminal, leave it out to pick a product from a list) |

### +unpublish

Remove a product from the online store. In an interactive terminal, the CLI asks you to confirm before it runs.

```shell
shoplazza products +unpublish --id <product-id>
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--id` | string | Yes | Product ID (in an interactive terminal, leave it out to pick a product from a list) |

### +stock

Set or adjust a variant's inventory. Target exactly one variant with `--variant-id`, `--sku`, or `--product-id`, and pass either `--set` or `--adjust`.

```shell
shoplazza products +stock [flags]
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--variant-id` | string | | Variant ID (exact target) |
| `--sku` | string | | Variant SKU (refused, with candidates listed, if it matches more than one variant) |
| `--product-id` | string | | Product ID (resolves a single-variant product's variant; multi-variant products are refused) |
| `--set` | int | | Set absolute stock value (≥ 0; mutually exclusive with `--adjust`) |
| `--adjust` | int | | Change stock by this amount (nonzero; positive adds, negative decreases; mutually exclusive with `--set`) |
| `--location-id` | string | | Location ID (defaults to default location) |

Decreases (a `--set` below current stock, or a negative `--adjust`) only work at the default location of an item stocked at a single location.

```shell
# Set absolute value
shoplazza products +stock --variant-id <id> --set 100

# Increase stock
shoplazza products +stock --variant-id <id> --adjust 50

# Target by SKU
shoplazza products +stock --sku SKU001 --adjust -5

# Specify location
shoplazza products +stock --variant-id <id> --set 100 --location-id <id>
```

### +set-price

Set a variant's price, targeting it by variant ID, SKU, or product ID.

```shell
shoplazza products +set-price [flags]
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--price` | string | Yes | New price (e.g. `24.99`) |
| `--compare-price` | string | | New compare-at price |
| `--variant-id` | string | | Variant ID (exact target) |
| `--sku` | string | | Variant SKU (refused, with candidates listed, if it matches more than one variant; use `--variant-id` or `--all`) |
| `--all` | bool | | With `--sku` only: update every variant matching the SKU |
| `--product-id` | string | | Product ID (resolves a single-variant product's variant; multi-variant products are refused; cannot be combined with `--variant-id` or `--sku`) |

One of `--variant-id`, `--sku`, or `--product-id` is required.

```shell
shoplazza products +set-price --sku SKU001 --price 24.99
shoplazza products +set-price --sku SKU001 --price 24.99 --compare-price 39.99
shoplazza products +set-price --variant-id <id> --price 19.99
```

### +set-variants

Edit an existing product's option matrix (dimensions × values) in one request: the CLI reads the product, applies every edit, and writes the full variant list back. Existing variants keep their ID, and with it their SKU, stock, and image.

```shell
shoplazza products +set-variants --id <product-id> [flags]
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--id` | string | Yes | Product ID |
| `--add` | string | | `"Dim:v1,v2"`: add values (one new variant per existing combination of the other dimensions); an unknown dimension name adds that dimension. Repeatable |
| `--remove` | string | | `"Dim:v1,v2"`: delete these values (exact spelling) and the variants using them. Repeatable |
| `--set` | string | | `"Dim:v1,v2"`: make the dimension's values exactly these, in this storefront order. Repeatable |
| `--drop` | string | | `"Dim"`: delete a dimension; `"Dim=value"`: keep only the variants with that value, then delete the dimension. Repeatable |
| `--rename` | string | | `"Dim:old=new,..."` renames values; `"OldDim=NewDim"` renames a dimension. Repeatable |
| `--existing` | string | | `"Dim:value"`: the value existing variants take in a dimension added with several values. Repeatable |
| `--new-price` | string | | Price for new variants with nothing to copy: a number, or `"Dim:v=price,..."` per value |
| `--new-image` | string | | Image (ID or URL of one of the product's images) for new variants with none to copy, or `"Dim:v=image,..."` per value; required on products that require variant images |
| `--new-stock` | int | | Stock for every new variant |
| `--set-price` | string | | Price for every variant: a number, or `"Dim:v=price,..."` for the variants with those values |
| `--set-stock` | int | | Stock for every variant (absolute, default location) |
| `--sku-template` | string | | SKU pattern applied to every variant, with `{Option Name}` placeholders (names after the edit), e.g. `TS-{Color}-{Size}` |

Edits apply in a fixed order (remove, drop, set, add, rename) whatever order you write them in, and every name refers to the product as it is now. The command refuses before writing anything if a name or value does not exist, a dimension appears in more than one of `--add`/`--remove`/`--set`/`--drop`, a drop would merge variants, the result would exceed 3 dimensions or 300 variants, or a new variant would have no price (or no image on products that require one). The output is a summary (`kept`, `cloned`, `created`, `deleted`, details, and `changes`), not the full product. The older `--action`/`--option`/`--price`/`--image`/`--stock` flags are deprecated and cannot be mixed with the flags above.

```shell
# Preview adding a Size dimension; existing variants become M
shoplazza products +set-variants --id <id> --add "Size:S,M,L" --existing "Size:M" --dry-run

# Remove a value and rename another
shoplazza products +set-variants --id <id> --remove "Color:Blue" --rename "Color:Red=Wine Red"

# Price per value
shoplazza products +set-variants --id <id> --set-price "Size:S=20,M=30,L=40"
```

### +tag

Add or remove product tags without overwriting the others, or replace them all.

```shell
shoplazza products +tag --id <product-id> [flags]
```

| Flag | Type | Required | Description |
|------|------|----------|-------------|
| `--id` | string | Yes | Product ID (in an interactive terminal, leave it out to pick a product from a list) |
| `--add` | string | | Tags to add (comma-separated); existing tags are kept |
| `--remove` | string | | Tags to remove (comma-separated); missing tags are ignored |
| `--set` | string | | Replace all tags with exactly this list (mutually exclusive with `--add`/`--remove`) |

One of `--add`, `--remove`, or `--set` is required.

```shell
shoplazza products +tag --id <id> --add "summer,sale"
shoplazza products +tag --id <id> --add new --remove old
shoplazza products +tag --id <id> --set clearance
```

## API commands

All dynamic API commands share these flags:

| Flag | Short | Description |
|------|-------|-------------|
| `--params` | | Path/query parameters as JSON |
| `--data` | | Request body as JSON (inline, `@file`, or `-` for stdin); only on commands that take a request body |
| `--jq` | `-q` | jq expression to filter output |
| `--dry-run` | | Preview the request without executing |



```shell
shoplazza products list
shoplazza products get --params '{"product_id":"123"}'
shoplazza products create --data @product.json
shoplazza products update --params '{"product_id":"123"}' --data '{"product":{"title":"Updated"}}'
shoplazza products delete --params '{"product_id":"123"}'
shoplazza products batch-delete --params '{"product_ids":["123","456"]}'
shoplazza products count
```

### products variants

```shell
shoplazza products variants list --params '{"product_id":"123"}'
shoplazza products variants get --params '{"variant_id":"456"}'
shoplazza products variants create --params '{"product_id":"123"}' --data @variant.json
shoplazza products variants update --params '{"variant_id":"456"}' --data @variant.json
shoplazza products variants delete --params '{"product_id":"123","variant_id":"456"}'
shoplazza products variants count --params '{"product_id":"123"}'
shoplazza products variants list-by-sku --params '{"sku":"SKU001"}'
shoplazza products variants update-by-sku --params '{"sku":"SKU001"}' --data @variant.json
```

### products images

```shell
shoplazza products images list --params '{"product_id":"123"}'
shoplazza products images get --params '{"product_id":"123","image_id":"789"}'
shoplazza products images create --params '{"product_id":"123"}' --data '{"image":{"src":"https://..."}}'
shoplazza products images update --params '{"product_id":"123","image_id":"789"}' --data @image.json
shoplazza products images delete --params '{"product_id":"123","image_id":"789"}'
shoplazza products images count --params '{"product_id":"123"}'
```

### products collections

```shell
shoplazza products collections list
shoplazza products collections get --params '{"id":"123"}'
shoplazza products collections create --data @collection.json
shoplazza products collections update --params '{"id":"123"}' --data @collection.json
shoplazza products collections delete --params '{"id":"123"}'
shoplazza products collections count
shoplazza products collections update-smart-rule --params '{"id":"123"}' --data @rules.json
shoplazza products collections async-create --data @collection.json
shoplazza products collections async-update-smart-rule --params '{"id":"123"}' --data @rules.json
shoplazza products collections get-async-task --params '{"id":"<task-id>"}'
```

### products collects

```shell
shoplazza products collects list
shoplazza products collects get --params '{"id":"123"}'
shoplazza products collects create --data '{"collect":{"product_id":"123","collection_id":"456"}}'
shoplazza products collects delete --params '{"id":"123"}'
shoplazza products collects batch-create --data @collects.json
shoplazza products collects count
```

### products inventory

```shell
shoplazza products inventory get --params '{"product_id":"123"}'
shoplazza products inventory list-items --params '{"inventory_item_ids":["123"]}'
shoplazza products inventory get-item --params '{"inventory_item_id":"123"}'
shoplazza products inventory update-item --params '{"inventory_item_id":"123"}' --data @item.json
shoplazza products inventory list-by-variant --params '{"variant_ids":["456"]}'
shoplazza products inventory set-stock --data '{"inventory_item_id":"123","location_id":"456","stock":100}'
shoplazza products inventory list-levels
shoplazza products inventory create-level --data @level.json
shoplazza products inventory update-level --data @level.json
shoplazza products inventory delete-level --data '{"inventory_item_id":"123","location_id":"456"}'
```

### products locations

```shell
shoplazza products locations list
shoplazza products locations get --params '{"location_id":"123"}'
shoplazza products locations count
shoplazza products locations get-default
shoplazza products locations set-default --params '{"location_id":"123"}'
shoplazza products locations deactivate --params '{"location_id":"123","target_location_id":"456"}'
shoplazza products locations edit-priority --params '{"location_ids":[123,456]}'
shoplazza products locations inventory-levels --params '{"location_id":"123"}'
```

### products gift-cards

```shell
shoplazza products gift-cards list
shoplazza products gift-cards get --params '{"id":"123"}'
shoplazza products gift-cards create --data @gift-card.json
shoplazza products gift-cards update --params '{"id":"123"}' --data @gift-card.json
shoplazza products gift-cards disable --params '{"id":"123"}'
shoplazza products gift-cards batch-create --data @gift-cards.json
```

### products categories

```shell
shoplazza products categories list
```

### products comments

```shell
shoplazza products comments list --params '{"product_id":"123"}'
shoplazza products comments create --data @comment.json
shoplazza products comments batch-create --data @comments.json
```

### products procurement

```shell
shoplazza products procurement list
shoplazza products procurement get --params '{"procurement_id":"123"}'
shoplazza products procurement create --data @procurement.json
shoplazza products procurement update --params '{"procurement_id":"123"}' --data @procurement.json
shoplazza products procurement receive --params '{"procurement_id":"123"}' --data @received.json
shoplazza products procurement cancel --params '{"procurement_id":"123"}'
shoplazza products procurement list-items --params '{"procurement_id":"123"}'
shoplazza products procurement batch-create-items --params '{"procurement_id":"123"}' --data @items.json
shoplazza products procurement batch-update-items --params '{"procurement_id":"123"}' --data @items.json
shoplazza products procurement batch-delete-items --params '{"procurement_id":"123"}' --data '{"procurement_item_ids":["456"]}'
```

### products suppliers

```shell
shoplazza products suppliers list
shoplazza products suppliers get --params '{"id":"123"}'
shoplazza products suppliers create --data @supplier.json
shoplazza products suppliers update --params '{"id":"123"}' --data @supplier.json
```

## Schema introspection

Explore all available product commands and their parameters:

```shell
# List all product commands
shoplazza schema products

# View parameters for a specific command
shoplazza schema products.list
```
