=== Factorize Colorways ===
Contributors: webyoungstown
Tags: woocommerce, variations, swatches, color, print on demand, apparel, svg
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.1.0
License: Factorize License (proprietary)
License URI: https://factorize.webyoungstown.com/license/

Color swatches, a print-placement picker, and product images that switch automatically from a file-name template — one product, every color, every placement.

== Description ==

Apparel and print shops sell one design in many garment colors and print placements. Assigning a picture to every variation by hand does not scale past a handful of products. Colorways resolves the picture from the file name instead: name your mockups `name-color-category.svg` (for example `skyline-black-tee.svg`), upload them, and every product page, shop card, cart line, order, and email shows the right color automatically.

* **Swatches** replace the Color dropdown on the product page; the image switches the moment a swatch is tapped.
* **Placement picker** (front, back, left chest, sleeve, …) as buttons, with a dashed print-area marker on the image — or a placement-specific mockup (`…-back.svg`) when one exists.
* **Size buttons** for the Size attribute; variations can use "Any size".
* **Shop cards** get a swatch strip; hover or tap switches the card image and opens the product with that color selected.
* **Carts, orders, emails, the block cart** all show the chosen color because variations resolve to the colorway image.
* **SVG uploads** for administrators and shop managers, sanitized on upload (scripts, event handlers, external references, and entities are stripped or rejected).
* **Coverage report** lists every product × color, which files exist, and the exact missing file names to copy.
* **Placeholder mockups** and an **example catalog** (twelve designs × 8 colors × placements) so the whole flow can be seen before real artwork exists.
* **Library importer** — point it at a folder of mockups (any depth, even a read-only mount) and it builds the whole catalog: one variable product per design × garment, every color × placement as a variation, collections and garments as categories, featured images set. Re-runnable.
* **Views** — a `{view}` token for renderings the customer does not buy (flat product shot vs. on a person), with a toggle on the product page.
* Works on phones and desktops; the marker follows the rendered image at any size.

Every plugin in the Factorize suite runs alone and stands up the shared Factorize hub; this one lives under the Selling tab.

== Installation ==

1. Upload the folder to `wp-content/plugins` (or the zip via Plugins → Add New → Upload) and activate.
2. Keep WooCommerce active.
3. Products → Attributes: make sure Color (and optionally Placement, Size) exist as global attributes; create variable products that use them for variations.
4. Name mockups `{name}-{color}-{category}.svg`, upload them (Media → Add New, or FTP into `uploads/colorways/` then Factorize → Colorways → Coverage → Rescan).
5. Open Factorize → Colorways → Coverage: everything green means every color has a picture.

== Frequently Asked Questions ==

= Do I have to assign images to variations? =
No. That is the point. A variation's own image still wins if you set one.

= What is {name}? =
The product's slug, unless you fill "Colorway image name" on the product (useful when one design ships on several garments: `skyline` on `skyline-black-tee.svg` and `skyline-black-hoodie.svg`).

= What is {category}? =
The product's first category slug, or the "Colorway image category" override on the product.

= Do placements need their own images? =
No. Without one, a dashed print-area marker shows where the print goes. With `…-back.svg` present, the picture switches to it.

= Are SVG uploads safe? =
Uploads are limited to administrators and shop managers and sanitized: scripts, `on*` handlers, external `href`s, `foreignObject`, DOCTYPE entities, and `@import` are removed; a file that cannot be parsed is rejected.

= Does anything leave my server? =
No.

== Changelog ==

= 1.1.0 =
* Library importer (`wp colorways import`, Colorways → Examples): catalog from a folder of mockups, idempotent by SKU.
* `{view}` token with a Product / On model toggle; `default_location` for templates where every file names a placement.
* Library folder indexed recursively (any depth, read-only mounts fine); folder files registered in the media library lazily on first use.
* `wp colorways scan`, `wp colorways rescan --index-only`.

= 1.0.0 =
* First release: template resolver, swatches, placement picker with marker, shop-card swatches, variation image resolution for carts/orders/emails, sanitized SVG uploads, coverage report, placeholder generator, example catalog, WP-CLI commands.
