← back to Shopify Room Mockup

README.md

52 lines

# shopify-room-mockup

Add photoreal **room-setting mockups** to Shopify products. For each selected
product it pulls the featured image (the pattern/swatch), renders a photoreal
room via the wallco room-setting service (`:3075` on the Kamatera box, over
SSH), and uploads the result as a product image.

Built from the Crowley's Crocodile batch (2026-05-29, designer-laboratory-sandbox):
11 colorways → 11 per-color living-room mockups, attached + READY.

## Usage

```bash
# whole pattern line, skip any product that already has a room mockup
python3 shopify-room-mockup.py --query "title:Crowley*" --skip-existing

# specific products, bedroom render
python3 shopify-room-mockup.py --ids 7797773500467,6811742175283 --room-type bedroom

# a whole collection, preview only (render but don't upload)
python3 shopify-room-mockup.py --collection 480239649 --dry-run
```

Select with exactly one of `--ids` / `--query` / `--collection`.

| flag | default | notes |
|---|---|---|
| `--store` | `designer-laboratory-sandbox` | handle or full `*.myshopify.com` |
| `--room-type` | `living_room` | `living_room`/`bedroom`/`dining_room`/`office` |
| `--pattern-width` / `--pattern-height` | `39` | repeat size in inches (scale on the wall) |
| `--box` | `root@45.61.58.125` | SSH host running the `:3075` room service |
| `--skip-existing` | off | skip products whose media alt already says "in a room" |
| `--alt-suffix` | `shown in a room` | alt-text suffix for the new image |
| `--limit` | 0 | cap products processed |
| `--dry-run` | off | render but don't upload |
| `--token-env` | `SHOPIFY_ADMIN_TOKEN` | falls back to `~/Projects/secrets-manager/.env` |

## Requirements
- Shopify Admin API token (`SHOPIFY_ADMIN_TOKEN`) with `write_products`.
- SSH access to the box running the room service on `127.0.0.1:3075`
  (the wallco `room-setting-app` pm2 process).
- `curl` (used for the staged multipart upload).

## How it works
1. GraphQL select → product id + featured image URL (+ existing media alts).
2. SSH to `--box`, download the image, POST to `:3075/api/generate-room`, stream
   the PNG back as base64.
3. `stagedUploadsCreate` → multipart upload the PNG → `productCreateMedia`.

Idempotent with `--skip-existing` (alt-text marker). Pipeline is store-agnostic —
point `--store` + token at any Shopify store.