## Understanding the Cost of Goods Manager

The Cost of Goods Manager is Alpha Insights' centralized tool for efficiently managing product costs across your entire WooCommerce catalog. Whether you have 10 products or 10,000, this tool provides a fast, intuitive way to set and maintain accurate cost data.

### What is the Cost of Goods Manager?

The Cost of Goods Manager is a dedicated interface that displays all your products in a sortable, filterable table where you can quickly view and edit costs. Unlike editing products one-by-one in WooCommerce, this manager lets you:

- See all products and their costs in one place
- Edit multiple costs rapidly using keyboard shortcuts
- Filter by category, supplier, stock status, and more
- Import/export costs via CSV for bulk operations
- See real-time profit margin and stock value calculations
- Migrate cost data from other plugins

### Why Product Costs Matter

Accurate product costs are the foundation of profitable business decisions. Without knowing what products actually cost you, it's impossible to:

- Calculate true profit margins: Knowing your margin on each sale helps you price competitively while staying profitable
- Identify unprofitable products: Some products might lose money after accounting for costs and advertising
- Make inventory decisions: Understanding which products generate the best returns guides purchasing
- Track business health: Overall profitability depends on accurate cost data
- Report financial performance: Accountants and tax reporting require cost of goods sold (COGS) information

### How Product Costs Are Calculated

Alpha Insights uses a intelligent hierarchical system to determine the cost for each product. The system checks each level in order and uses the first available value:

#### Priority 1: Product-Specific Cost (Highest Priority)

If you have set a custom cost directly on a product using the Cost of Goods Manager or the product edit page, that value will always be used. This is stored in the product meta field `_wpd_ai_product_cost`.

Example: You set T-Shirt Blue (Large) to cost $12.50 - this exact value is always used for that variation.

#### Priority 2: Parent Product Cost (Variable Products)

For variable products, if you set a cost on the parent product but not on individual variations, all variations will inherit the parent's cost. This saves time when all variations have the same cost.

Example: You set the parent "T-Shirt" product cost to $12.00. All size/color variations automatically use $12.00 unless they have their own specific cost set.

#### Priority 3: Default Cost Percentage (Fallback)

If no custom cost is set at the product or parent level, Alpha Insights calculates cost using your default percentage setting. This percentage is applied to the product's regular retail price (RRP).

Example: Your default is set to 40% of RRP. A product priced at $50.00 would automatically have a calculated cost of $20.00 (40% of $50).

Configuration: You can set your default percentage in Alpha Insights → Settings → Cost Defaults.

#### Visual Indicators in the Cost Manager

The Cost of Goods Manager shows you which products have custom costs vs. calculated defaults:

- Products with custom costs: Display the cost value in black text in the cost field
- Products using defaults: Show an empty input with placeholder text "Enter cost" and a helper line below showing "Default: $XX.XX"
- Modified but unsaved: Highlighted in yellow/orange with visual indicator

### Key Features of the Cost Manager

#### Real-Time Statistics Dashboard

At the top of the page, six statistics cards provide instant insight into your catalog:

- Total Products: How many products are currently displayed (affected by filters)
- With Cost Set: Products that have custom costs entered
- Without Cost: Products using default calculated costs
- Avg Margin: Your average profit margin percentage across all products
- Stock Value (RRP): Total inventory value at retail prices
- Stock Value (Cost): Total inventory value at your cost

These statistics update automatically as you apply filters or make changes, helping you track progress and identify opportunities.

#### Advanced Filtering

Quickly narrow down products using multiple filter options:

- Search: Find products by name or SKU
- Category: Filter by WooCommerce product category
- Supplier: Filter by supplier taxonomy (if you use supplier organization)
- Stock Status: Show only in stock, out of stock, or backordered products
- Product Type: Filter by simple products, variable products, or variations
- Cost Status: Show all products, only those with custom costs, or only those missing costs

Filters can be combined to create very specific product lists (e.g., "Electronics category, in stock, missing costs").

#### Inline Cost Editing

The table interface makes updating costs incredibly fast:

- Click any cost field to edit
- Press Tab to move to the next product
- Make multiple changes, then save all at once
- See profit margins and per-unit profit update in real-time as you type
- Press Enter to save changes immediately

This approach is 10x faster than editing products individually in WooCommerce.

#### Sortable Columns

Click any column header to sort products by that value:

- Product Name: Alphabetical sorting
- RRP: Find highest/lowest priced products
- Cost: Identify most/least expensive products to source
- Margin %: Find your most and least profitable products
- Profit: See which products generate most profit per sale
- Stock: Sort by inventory levels

#### CSV Import & Export

For bulk operations, you can work with costs in spreadsheet software:

- Export: Download all product costs to CSV for analysis or backup
- Import: Upload a CSV file to update hundreds or thousands of costs at once
- Use cases: Initial setup, supplier price updates, periodic reviews, multi-supplier management

#### Migration Tool

If you're switching from another cost management plugin, the Migration Tool automatically copies existing cost data to Alpha Insights. Supported plugins include:

- WooCommerce Cost of Goods (SkyVerge)
- WooCommerce 10.0+ Native COGS
- ATUM Inventory Management
- Cost of Goods for WooCommerce (Algoritmika)
- YITH Cost of Goods
- Generic purchase price fields

#### Stock Value Tracking

The Cost Manager calculates your total inventory value in two ways:

- Stock Value (RRP): What your inventory would be worth if you sold everything at full retail price
- Stock Value (Cost): What you've invested in your current inventory at cost

This helps with inventory management, insurance valuations, and financial reporting.

### When to Use the Cost Manager

#### Initial Setup

When first implementing Alpha Insights, use the Cost Manager to add costs to your entire catalog. The "Missing Cost" filter helps you track progress as you work through products.

#### Ongoing Maintenance

As you add new products or receive supplier price updates, return to the Cost Manager to add or update costs. The real-time statistics help you maintain data quality.

#### Periodic Reviews

Schedule monthly or quarterly reviews to:

- Update costs based on supplier price changes
- Identify products with unexpectedly low margins
- Find data entry errors or outliers
- Re-evaluate default cost percentage if needed

#### Financial Reporting

Before closing monthly books or preparing for tax season, use the Cost Manager to ensure all cost data is current and accurate. Export the data for your accountant if needed.

### Data Storage and Compatibility

Product costs are stored using WordPress standard post meta fields:

- Meta Key: `_wpd_ai_product_cost`
- Storage Location: wp_postmeta table
- Compatibility: Works with all WooCommerce product types (simple, variable, variations, grouped, etc.)
- Persistence: Costs remain in your database even if Alpha Insights is deactivated (for data safety)

### Performance Considerations

The Cost Manager is built for efficiency, even with large catalogs:

- Pagination: Products load in pages (25, 50, 100, or 200 per page) to maintain fast load times
- AJAX Loading: Filtering and sorting happen instantly without full page reloads
- Efficient Queries: Database queries use WordPress best practices for speed
- Caching: When you update a cost, the system automatically clears relevant cache for accurate profit calculations

### Common Use Cases

#### Scenario 1: New Store Setup

You've just installed Alpha Insights and need to add costs for 300 products. Your supplier provided an Excel price list.

1. Export a CSV from Cost Manager to get your product SKUs
2. Match your SKUs with supplier's price list in Excel
3. Import the CSV to add all costs at once
4. Use the "Missing Cost" filter to find any products that didn't match, add those manually

#### Scenario 2: Quarterly Price Increase

Your supplier increased all costs by 5%. You want to update 150 products from that supplier.

1. Filter by Supplier taxonomy
2. Export filtered products to CSV
3. In Excel, multiply all costs by 1.05
4. Import the updated CSV
5. Review the "Avg Margin" stat to see how the increase affects profitability

#### Scenario 3: Finding Low-Margin Products

You want to identify products with margins below 20% to consider repricing or discontinuing.

1. Sort by "Margin %" column (ascending)
2. Review the lowest-margin products
3. Decide whether to increase prices, reduce costs, or discontinue items
4. Update costs or note products for price changes

#### Scenario 4: New Product Batch

You just added 20 new products and need to set their costs quickly.

1. Filter by "Cost Status: Missing Cost"
2. Click the first product's cost field
3. Type cost, press Tab, type next cost, Tab... rapidly update all 20
4. Press Enter or click "Save All Changes"

### Best Practices

- Set costs for best-sellers first: Focus on products that affect your bottom line most
- Use the default percentage wisely: Set a conservative default that gives reasonable estimates for products without custom costs
- Regular backups: Export costs to CSV monthly as a backup
- Supplier organization: Use the supplier taxonomy to organize products by source for easier updates
- Review margins regularly: Sort by margin percentage monthly to spot problems early
- Track progress: Watch the "Without Cost" stat decrease as you add custom costs

### Integration with Alpha Insights Reports

Costs managed here directly feed into all Alpha Insights profit calculations:

- Order Profit Reports: Every order's profit is calculated using the costs set here
- Product Performance Reports: Product-level profitability uses these costs
- Dashboard Widgets: Revenue minus costs equals profit in all widgets
- Expense Reports: Total business profit accounts for both product costs and additional expenses

Accurate costs here mean accurate profit data everywhere in Alpha Insights.

### Next Steps

Now that you understand what the Cost of Goods Manager is and how it works, you're ready to start using it:

- Using the Cost of Goods Manager: Step-by-step guide to accessing, filtering, editing, and managing costs
- Importing Costs via CSV: Detailed instructions for bulk import operations