- 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)
2.5 KiB
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
- FREEZE CHANGES to the spreadsheet while this migration is in progress
- Remove
sku_prefixcolumn fromproduct_inventorysheet. This will disable the existing automation by removing one of the needed inputs that is controlled by an instant ARRAYFORMULA. - Update column names in
product_inventoryandvaluessheets to match new SKU logic - Update
newSku.tsto use new SKU logic - Update
MediaManager.tsto use new SKU logic
Detailed Migration Steps
product_inventory sheet
- Remove
sku_prefixcolumn - Change
typetoproduct_style - Move
product_stylecolumn to the right ofproduct_type - Remove
functioncolumn - Remove
#column - Remove
stylecolumn- This column is not currently used in any active way, and is confusingly named. It should be removed.
values sheet
- Add
sku_prefixcolumn type_sku_code->sku_suffixcolumn- Remove
functionandfunction_sku_codecolumns type->product_style
product_types sheet
- Remove
functioncolumn - Change
typetoproduct_style
Product class
- Rename
type->product_style(to match the plan). - Remove
functionproperty. - Remove the existing
style: string[]property (Line 24).
newSku.ts
- Move manual trigger to
skucolumn - Add safety check to ensure that existing
skuvalues are not overwritten. If the product already has askuin Shopify, use it. Only check ifskuis empty andshopify_idis defined. - Start using
product_type->sku_prefixlookup +product_style->sku_suffixlookup for SKU code
Media Manager
- If
product_typeandproduct_styleare defined, butskuis not, request a new SKU after confirming values are correct - If either
product_typeorproduct_styleare undefined, prompt the user to define them, then request a new SKU
Cleanup
- Scrub code for columns that have been removed
functioncolumnfunction_sku_codecolumntype_sku_codecolumn#columnstylecolumn
- Scrub code for logic that has been removed
- Backfill