Files
product_inventory/docs/SKU logic migration plan.md
Ben Miller 778c0d1620 Fix Media Manager UI bugs and add SKU migration logic
- Fix syntax errors and logic in MediaManager.html

- Fix SpreadsheetApp mocking in mediaHandlers.test.ts

- Add SKU logic migration plan and backfill script

- Update Product.ts and global.ts exports

- Update newSku.ts and add newSku.test.ts

- Ensure all tests pass (71/71)
2026-01-03 11:44:49 -07:00

2.5 KiB

SKU logic migration plan

2026-01-03

Summary

The goal of this migration is to reduce the number of touchpoints required to create a new SKU. User should only have to define product_type and product_style once, and then a new SKU should be created automatically when needed.

High Level Migration Steps

  1. FREEZE CHANGES to the spreadsheet while this migration is in progress
  2. Remove sku_prefix column from product_inventory sheet. This will disable the existing automation by removing one of the needed inputs that is controlled by an instant ARRAYFORMULA.
  3. Update column names in product_inventory and values sheets to match new SKU logic
  4. Update newSku.ts to use new SKU logic
  5. Update MediaManager.ts to use new SKU logic

Detailed Migration Steps

product_inventory sheet

  • Remove sku_prefix column
  • Change type to product_style
  • Move product_style column to the right of product_type
  • Remove function column
  • Remove # column
  • Remove style column
    • This column is not currently used in any active way, and is confusingly named. It should be removed.

values sheet

  • Add sku_prefix column
  • type_sku_code -> sku_suffix column
  • Remove function and function_sku_code columns
  • type -> product_style

product_types sheet

  • Remove function column
  • Change type to product_style

Product class

  • Rename type -> product_style (to match the plan).
  • Remove function property.
  • Remove the existing style: string[] property (Line 24).

newSku.ts

  • Move manual trigger to sku column
  • Add safety check to ensure that existing sku values are not overwritten. If the product already has a sku in Shopify, use it. Only check if sku is empty and shopify_id is defined.
  • Start using product_type -> sku_prefix lookup + product_style -> sku_suffix lookup for SKU code

Media Manager

  • If product_type and product_style are defined, but sku is not, request a new SKU after confirming values are correct
  • If either product_type or product_style are undefined, prompt the user to define them, then request a new SKU

Cleanup

  • Scrub code for columns that have been removed
    • function column
    • function_sku_code column
    • type_sku_code column
    • # column
    • style column
  • Scrub code for logic that has been removed
  • Backfill