zach.dev
← All projects

COGS & SKU Profitability Engine

Designed a cost calculation system that supported thousands of standard SKUs and hundreds of thousands of dynamically generated custom SKUs, enabling SKU-level profitability tracking and better pricing decisions.

  • Python
  • PostgreSQL
  • Supabase
  • SQL
  • Next.js
  • TypeScript
  • pandas

Overview

I designed and built a COGS and SKU profitability engine to calculate product costs across a complex ecommerce catalog. The system supported both standard SKUs and dynamically generated custom SKUs, making it possible to estimate profitability at a much more granular level.

This project was built to improve pricing decisions, margin visibility, and reporting accuracy.

Problem

The business had a large product catalog with many size, material, and shape combinations. Standard SKU-level cost tracking was not enough because many products could be dynamically generated from dimensions and product rules.

Without a reliable way to calculate product-level cost, it was difficult to accurately measure profitability, compare channels, or make confident pricing decisions.

Solution

I created logic to calculate costs based on SKU structure, product size, shape, material, and adjustment codes.

The system included:

  • SKU parsing logic
  • Size code interpretation
  • Width and length calculations
  • Shape-based rules
  • Adjustment code handling
  • Cost lookup tables
  • Support for standard and custom SKUs
  • Integration with reporting and profitability workflows

The result was a reusable engine that could support profitability analysis across a much larger SKU universe than a manually maintained table would allow.

Impact

This project enabled more accurate SKU-level profitability tracking and helped improve visibility into product margins. It also supported better pricing decisions by connecting product structure, cost, and channel performance.

Instead of treating cost as a static field, the system made cost calculation dynamic and scalable.

What I Learned

This project taught me how important clean business logic is when building data tools. A strong profitability system is not just about storing data. It requires understanding how products are structured, how costs are created, and how those rules need to scale over time.