Athenian Supplier & Cost-of-Goods Tracking for WooCommerce
Overview
Product overview
Athenian Supplier & Cost-of-Goods Tracking for WooCommerce adds a practical supplier and COGS management layer directly inside the WooCommerce admin experience. It gives store operators a structured way to connect products and variations to suppliers, define purchase costs and usable units, calculate derived unit costs, and build finished-product cost estimates from raw material components.
The plugin is especially useful for manufacturing, print-on-demand, custom product, fulfillment, and production-driven WooCommerce stores where the selling product is often assembled from consumables, raw materials, machine usage, or vendor-supplied components. Rather than tracking only a flat cost value, the plugin supports a more operational model: purchase cost divided by purchase units, raw input quantities consumed per finished unit, variation-level overrides, and optional Athenian Asset Management integration for equipment consumables such as ink, media, machine usage, or wear-related inputs.
From a business standpoint, this plugin helps make WooCommerce product data more useful for margin awareness, quoting, vendor routing, purchasing review, operational planning, and scalable catalog management. From a technical standpoint, it is implemented as an admin-only WooCommerce extension with supplier CPTs, product and variation meta fields, AJAX-powered manager screens, JSON-normalized component storage, and compatibility paths for Athenian Asset Management asset-consumable data.
---
Use cases
- Supplier catalog management
- Margin review
- Wholesale and vendor operations
- Cost-aware inventory workflows
Developer
Developer starting point
This baseline is generated from the reviewed local technical reference and source folder. Deployed-version parity and external-provider effects remain separate verification steps.
Admin Workflow
1. Create Suppliers
Admins create supplier records under the WooCommerce supplier menu. Supplier records support title, notes, email, phone, and website fields.
2. Define Raw Material Costing
Raw materials can be created as WooCommerce products or variations. Admins assign purchase cost, units per purchase, and unit label. The plugin calculates a derived unit cost from those values.
3. Assign Costs to Finished Products
Finished products can either have their own purchase-unit cost or be built from raw material components. Components define which product or variation is consumed and how much is used per finished unit.
4. Override Variation Costs as Needed
Variations can inherit parent product settings or override individual COGS fields. This keeps large product families manageable while still allowing accurate cost detail where variations differ.
5. Review and Edit in the Manager Screen
The Supplier & COGS Manager allows admins to search, filter, edit, and save costing data without opening every product manually.
6. Include Asset Consumables When Available
If Athenian Asset Management is configured, product or variation asset usage can contribute additional consumable cost to the COGS estimate.
---
Technical Overview
Plugin Bootstrap
Main file:
athenian-supplier-cogs-tracking.phpThe plugin defines constants for version, directory, and URL, loads supporting classes, registers activation/deactivation hooks, and initializes key admin services.
Loaded classes:
includes/class-ath-cogs-utils.php
includes/class-ath-cogs-cpt-supplier.php
includes/class-ath-cogs-product-meta.php
includes/class-ath-cogs-admin.php
includes/class-ath-cogs-asset-integration.phpInitialization Hooks
The plugin initializes through WordPress and WooCommerce admin hooks:
init
admin_init
admin_enqueue_scripts
woocommerce_product_data_tabs
woocommerce_product_data_panels
woocommerce_admin_process_product_object
woocommerce_product_after_variable_attributes
woocommerce_save_product_variation
save_post_product
save_post_product_variationThe plugin is admin-focused and only loads its interface assets for relevant product, manager, and eligible asset editor screens.
---
Data Model
Supplier CPT
Post Type: ath_supplierSupplier meta fields:
_ath_supplier_email
_ath_supplier_phone
_ath_supplier_siteProduct and Variation Meta
_ath_cogs_supplier_id
_ath_cogs_purchase_cost
_ath_cogs_purchase_units
_ath_cogs_purchase_unit_label
_ath_cogs_components_jsonAAM / Asset Usage Meta
Primary AAM-owned product or variation asset usage key:
_aam_asset_usage_jsonLegacy fallback key:
_ath_cogs_asset_usage_jsonAsset consumable definition keys:
_aam_cogs_measure_unit
_aam_cogs_consumables_json
_ath_cogs_asset_measure_unit
_ath_cogs_asset_consumables_jsonThe plugin writes both AAM-oriented and legacy COGS-oriented asset consumable keys in the fallback asset metabox save routine for compatibility.
---
Cost Calculation Models
Purchase Unit Cost
unit_cost = purchase_cost / purchase_unitsUsed for raw materials, standalone products, and variation overrides.
Component Cost
component_cogs = Σ(raw_unit_cost × quantity_consumed_per_finished_unit)Each component row supports:
{
"product_id": 123,
"variation_id": 0,
"qty": 1,
"note": "Example raw material"
}Asset Consumable Cost
asset_cost = Σ(unit_cost(consumable) × measure_qty × per_measure × share_pct)Asset consumable rows support:
{
"product_id": 123,
"variation_id": 0,
"per_measure": 0.25,
"share_pct": 16.67,
"note": "Cyan ink usage"
}Product or variation asset usage rows support:
{
"asset_id": 456,
"measure_qty": 12.5,
"share_pct": 0,
"consumables": []
}Computed Preview
The manager UI exposes computed values for:
Unit Cost
Components COGS
Asset COGS
Total COGS
Batch Qty PreviewThe current backend ajax_get_cogs response calculates component and asset cost, and returns a total preview. In the reviewed version, the total_cogs response is currently based on component and asset cost, while direct unit cost is separately returned as unit_cost.
---
AJAX Endpoints
All AJAX endpoints require WooCommerce management capability and a verified nonce using the plugin nonce action.
| Action | Purpose | |---|---| | ath_cogs_search_products | Search products and variations by name/SKU and optional supplier/type filters. | | ath_cogs_get_cogs | Load COGS detail for a product or variation, including inherited values and computed costs. | | ath_cogs_save_cogs | Save supplier, purchase unit fields, component rows, inheritance flags, and asset usage data. | | ath_cogs_list_suppliers | Return supplier options for manager dropdowns. | | ath_cogs_list_assets | Return available AAM assets when the aam_asset post type exists. | | ath_cogs_calc_components_cost | Calculate total component cost from a submitted component JSON payload. |
---
Permissions and Security
The plugin is designed for WooCommerce administrative users.
Security controls include:
manage_woocommercechecks for manager access.current_user_can('edit_post', $id)checks before saving target post data.- AJAX nonce validation through the
ath_cogs_adminnonce action. - Sanitization of supplier contact fields.
- Numeric sanitization for cost, unit, and quantity values.
- Field-by-field normalization of component JSON arrays.
- Defensive JSON repair instead of unsafe whole-blob sanitization.
- Admin-only asset enqueueing on supported screens.
- Escaped output for admin fields and rendered UI values.
---
Implementation Notes From Review
- The plugin performs clean PHP syntax validation across all PHP files in the reviewed ZIP.
- The product editor adds a Suppliers & COGS WooCommerce data tab.
- The manager screen is registered under WooCommerce as Supplier & COGS.
- The supplier CPT is private on the frontend but visible in the WordPress admin UI.
- Variation save handling includes both WooCommerce variation hooks and post-save repair hooks.
- Component JSON handling is intentionally defensive because production notes may include quotes or inch marks.
- Asset usage is treated as AAM-owned when newer AAM functionality is detected.
- The plugin currently focuses on admin-side data management and computed previews, not frontend display.
---
Install
- Reviewed source folder: athenian-supplier-cogs-tracking
- Plugin version reviewed: 0.7.1
- Local source inventory: 13 files (vendor, temporary, test, and Git metadata excluded).
- GitHub baseline: https://github.com/Athenian-Brands/athenian-supplier-cogs-tracking at baseline/devdocs-0.7.1-20261006 / 1983fcaf5144d756c09508867c25db6ae113009e.
- WordPress and WooCommerce.
- Supplier and cost values remain store data and should be reconciled with the target catalog before production use.
Configuration
- Executive Summary — see the linked technical reference excerpt.
- Short Description — see the linked technical reference excerpt.
- Marketing Description — see the linked technical reference excerpt.
- Core Value Proposition — see the linked technical reference excerpt.
- Feature Highlights — see the linked technical reference excerpt.
- Ideal Use Cases — see the linked technical reference excerpt.
- Suggested Positioning — see the linked technical reference excerpt.
- Admin Workflow — see the linked technical reference excerpt.
- Technical Overview — see the linked technical reference excerpt.
- File Structure — see the linked technical reference excerpt.
- Data Model — see the linked technical reference excerpt.
- Cost Calculation Models — see the linked technical reference excerpt.
- AJAX Endpoints — see the linked technical reference excerpt.
- Permissions and Security — see the linked technical reference excerpt.
Usage
- Shortcodes detected in local PHP source: 0
- Static action/filter hooks detected in local PHP source: 21
- REST route registrations detected in local PHP source: 0
Shortcodes
- No static add_shortcode registrations were detected by the baseline scanner.
REST Endpoints
- No register_rest_route calls were detected by the baseline scanner.
Hooks
- add_meta_boxes — includes/class-ath-cogs-asset-integration.php
- add_meta_boxes — includes/class-ath-cogs-cpt-supplier.php
- admin_enqueue_scripts — athenian-supplier-cogs-tracking.php
- admin_init — athenian-supplier-cogs-tracking.php
- admin_menu — includes/class-ath-cogs-admin.php
- init — athenian-supplier-cogs-tracking.php
- save_post_product_variation — includes/class-ath-cogs-product-meta.php
- save_post_product — includes/class-ath-cogs-product-meta.php
- save_post_ — includes/class-ath-cogs-cpt-supplier.php
- save_post — includes/class-ath-cogs-asset-integration.php
- woocommerce_admin_process_product_object — includes/class-ath-cogs-product-meta.php
- woocommerce_product_after_variable_attributes — includes/class-ath-cogs-product-meta.php
- woocommerce_product_data_panels — includes/class-ath-cogs-product-meta.php
- woocommerce_product_data_tabs — includes/class-ath-cogs-product-meta.php
- woocommerce_save_product_variation — includes/class-ath-cogs-product-meta.php
- wp_ajax_ath_cogs_calc_components_cost — includes/class-ath-cogs-admin.php
- wp_ajax_ath_cogs_get_cogs — includes/class-ath-cogs-admin.php
- wp_ajax_ath_cogs_list_assets — includes/class-ath-cogs-admin.php
- wp_ajax_ath_cogs_list_suppliers — includes/class-ath-cogs-admin.php
- wp_ajax_ath_cogs_save_cogs — includes/class-ath-cogs-admin.php
- wp_ajax_ath_cogs_search_products — includes/class-ath-cogs-admin.php
Data Model
- Data Model — described in the local technical reference.
- Cost Calculation Models — described in the local technical reference.
API Reference
- Local source digest: 7017bfea85e5a66415c161ee7a9d3c8bca0dc13bbcff934418301c327e50fe35
- Repository URL: https://github.com/Athenian-Brands/athenian-supplier-cogs-tracking
- Repository reference: baseline/devdocs-0.7.1-20261006
- Repository commit: 1983fcaf5144d756c09508867c25db6ae113009e
Source files include: assets/admin.css, assets/admin.js, athenian-supplier-cogs-tracking-technical-marketing.md, athenian-supplier-cogs-tracking.php, athenian-supplier-cogs-tracking.zip, docs/athenian-platform-marketing.md, docs/athenian-platform-technical.md, docs/technical-marketing.md, includes/class-ath-cogs-admin.php, includes/class-ath-cogs-asset-integration.php, includes/class-ath-cogs-cpt-supplier.php, includes/class-ath-cogs-product-meta.php, includes/class-ath-cogs-utils.php
Troubleshooting
- This baseline is generated from the reviewed local technical reference and source folder. Deployed-version parity and external-provider effects remain separate verification steps.
- Confirm the deployed plugin version, active dependencies, and current repository tree before using implementation details as a release contract.
- Treat payment, carrier, vendor, shipment, inventory, account, credential, and external-provider behavior as integration-dependent until exercised in the target environment.
FAQ
What is this page intended to establish?
A versioned, product-linked starting point for iterative developer documentation. It combines the local implementation reference with a compact detected-code inventory and a committed GitHub baseline.
Is the linked repository baseline verified?
Yes. The repository URL, ref, and commit recorded on this page were verified from the clean GitHub baseline prepared for this documentation pass. That does not by itself prove fleet deployment parity.
What remains for release-grade documentation?
Reconcile the recorded source baseline with the deployed plugin version, then exercise the relevant authenticated, store, provider, payment, carrier, or generated-artifact paths in the target environment.