- Implemented modular status automation system (statusHandlers.ts). - Added handlers for 'Published' (Active/Qty 1), 'Sold' (Active/Qty 0), and 'Drafted'. - Refactored onEdit triggers into a central Router pattern in OnEditHandler.ts. - Updated Product.ts to support explicit quantity setting (fixed 0 value bug). - Updated shopifyApi.ts to implement SetInventoryItemQuantity (using ignoreCompareQuantity). - Consolidated triggers into single onEditHandler. - Updated project documentation.
52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
# Product Inventory Management
|
|
|
|
This project integrates Google Sheets with Shopify to manage product inventory, photos, and metadata. It uses Google Apps Script to synchronize data between a "master" Google Sheet and your Shopify store.
|
|
|
|
## Overview
|
|
|
|
The system allows you to:
|
|
- Manage product details (SKUs, titles, descriptions) in a Google Sheet.
|
|
- Automatically upload product photos from Google Drive to Shopify.
|
|
- specific triggers (`onEdit`, `onOpen`) to sync changes to Shopify in real-time or on-demand.
|
|
- Handle rate limiting and concurrency using a custom queue system.
|
|
- Handle rate limiting and concurrency using a custom queue system.
|
|
- Monitor and troubleshoot background processes via a custom side panel.
|
|
- **Automated Sales Sync**: Periodically check Shopify for recent sales and mark items as "sold" in the sheet.
|
|
- **Manual Reconciliation**: Backfill sales data for a specific time range via menu command.
|
|
- **Status Workflow Automation**: Automatically update Shopify status and inventory based on the sheet's "status" column (e.g., "Sold" -> Active, 0 Qty).
|
|
|
|
## Prerequisites
|
|
|
|
- **Node.js**: managed via `fnm` (Fast Node Manager)
|
|
- **Google Clasp**: for pushing code to Apps Script
|
|
- **Google Cloud Project**: tied to the Apps Script container
|
|
|
|
## Quick Start
|
|
|
|
1. **Install Dependencies**
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
2. **Build Project**
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
3. **Deploy to Apps Script**
|
|
```bash
|
|
npm run deploy
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
- `src/`: Source code (TypeScript)
|
|
- `src/config.ts`: Configuration loading from Sheets
|
|
- `src/global.ts`: Entry points for Apps Script
|
|
- `src/shopifyApi.ts`: Shopify Admin API wrapper
|
|
- `src/onEditQueue.ts`: Concurrency management
|
|
|
|
For more details, see:
|
|
- [Architecture Guide](docs/ARCHITECTURE.md)
|
|
- [Setup Guide](docs/SETUP.md)
|