Bizmart

Bizmart Documentation

Technical reference and setup guide for WooCommerce Cost of Goods (COGS), WAC inventory valuation, gross vs. operating profit formulas, supplier FIFO invoices, and release history.

1. System Requirements & Database Architecture

  • WordPress: 5.8 or newer (tested up to WordPress 6.x / 7.0)
  • WooCommerce: 5.0–10.x (compatible with High-Performance Order Storage / HPOS)
  • PHP: 7.4 or newer (PHP 8.1+ recommended)
  • Supported Product Types: Simple, Variable (per-variation purchase prices), Grouped, External, and Digital/Downloadable
  • Trilingual Admin UI: English, French, and Arabic (RTL-ready with 321 built-in Arabic strings)
  • Local Database Storage: Uses dedicated tables prefixed with bizmart_ (bizmart_invoices, bizmart_invoice_items, bizmart_suppliers, bizmart_payments, bizmart_expenses, bizmart_price_history). Zero external SaaS data sync.

2. Installation Walkthrough

  1. Download the Bizmart Core plugin ZIP (bizmart-cost-of-goods-v1.0.2.zip).
  2. In WordPress Admin, navigate to Plugins → Add New → Upload Plugin, choose the ZIP file, and click Install Now.
  3. Click Activate Plugin. A new Bizmart menu appears in your WordPress admin sidebar.
  4. Navigate to Bizmart → Settings to configure your company details, currency display, expense categories, and valuation method (last_price, manual, or wac).
  5. To unlock Premium modules (Suppliers, FIFO Invoices, Expenses, Cashflow Calendar), install the Premium add-on and activate your annual license key.

3. Setting WooCommerce Purchase Costs (4-Step Resolution Chain)

Open Bizmart → Products to manage purchase costs inline or via background CSV import. When resolving a product or variation’s purchase cost, Bizmart checks the following chain in order:

  1. Weighted Average Cost (WAC / CUMP Mode): If valuation is set to wac, Bizmart computes SUM(quantity × purchase_price) ÷ SUM(quantity) across approved supplier invoices.
  2. Product / Variation _purchase_price: Direct purchase price stored on the product or variation.
  3. Parent _purchase_price Fallback: Variations without a custom purchase price inherit their parent product’s _purchase_price.
  4. Legacy _alg_wc_cog_cost Fallback: Automatically reads existing _alg_wc_cog_cost meta keys from prior COGS plugins before defaulting to 0.00.
Frozen Order Cost (_bizmart_item_cost): When an order is placed, Bizmart records the item’s cost on the order line item so later supplier price changes never alter historical order profitability.

4. Exact Profit & Inventory Valuation Formulas

Order & Period Profit Formulas:

  • Gross Revenue: Sum of WooCommerce order totals in the date range (excluding WC_Order_Refund records).
  • Cost of Goods Sold (COGS): Σ (frozen _bizmart_item_cost or resolved purchase_price × quantity).
  • Gross Profit (Core): Gross Revenue − COGS.
  • Gross Margin (%): (Gross Profit ÷ Gross Revenue) × 100.
  • Profit After Operating Expenses (Premium): Gross Profit − Σ (logged bizmart_expenses in date range). (Note: unlogged expenses or corporate income taxes are not deducted unless entered as expenses.)

Inventory Stock Valuation Rules (includes/metrics.php):

  • Products with stock management ON use their actual WooCommerce stock quantity.
  • Products with stock management OFF but status instock count as qty = 1 so active un-managed items are not omitted.
  • Variable products deduplicate parent vs. variation stock management automatically.
  • Negative stock (backorders) is included to reflect real fulfillment liability.
  • Results are cached for 10 minutes in transient bizmart_inventory_totals_v9 and invalidated automatically on stock/cost updates.

5. Suppliers, Price History & FIFO Invoice Engine (Premium)

Create supplier profiles under Bizmart → Suppliers and log purchase invoices with due dates. Approved invoices automatically populate bizmart_price_history, allowing you to compare minimum, maximum, and average unit purchase prices per supplier. When you record a lump-sum payment via the Global Payment Engine, FIFO (First-In, First-Out) logic settles the oldest unpaid invoices first.

6. Operating Expenses & Cashflow Calendar (Premium)

Log one-off or recurring monthly/yearly operating expenses by category (Marketing, Logistics, Office Rent, Hosting) in bizmart_expenses. The Cashflow Calendar plots daily billed inflows against outgoing expenses and supplier payments on a monthly grid.

7. Changelog

Actively Maintained
Core Engine v2.2.0 / Package v1.0.2 Current Release
  • Inventory metrics: Products with stock management OFF but status instock counted as qty = 1.
  • Performance: Transient cache key bumped to v9 with automatic legacy cleanup and smart invalidation.
  • Localization: Complete trilingual support (English, French, and 321 Arabic RTL strings).
  • Security: Capability checks on all form handlers and strict output escaping across admin pages.
v2.1.0
  • Unified nonce verification, lazy-loaded Arabic translation dictionary, and static option cache.
  • Extracted shared helpers and Add-on API hooks for Invoices, Suppliers, and Finance modules.
v1.1.0 / v1.0.0
  • Initial release with Analytics Dashboard, Company Settings, and Redesigned Products & Orders Management.