=== Oakhammer BOM Pricing for WooCommerce ===
Contributors: oakhammer
Tags: product bundles, kits, cost of goods, composite products, pricing
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Price bundles, kits and assembled products from their parts. Track cost of goods and margin, and catch every kit when a part cost changes.

== Description ==

If you sell bundles, kits or things you build from parts — custom bikes, gaming PCs, furniture, tool kits, gift boxes, meal kits — you have probably set prices by hand and missed it when a part got more expensive. BOM Pricing fixes that.

Give each product a bill of materials (BOM): the parts, labor and packaging that go into it. BOM Pricing adds up the cost of goods (COGS), applies your markup or target margin, and sets the price. When a supplier raises a part's cost, every bundle and kit that uses it is recalculated and flagged, so your margins don't quietly shrink.

* **Bill of materials on any product or variation.** Add components (any simple product or any specific variation) and non-product costs like labor, packaging or freight.
* **Variation-level BOMs that show the exact variation.** Lines read "Frame — Size: Large, Color: Blue (SKU FRAME-L-BLU)", not just the parent product name.
* **Shared lines for variable products.** Put the wheels and saddle on the product once; add only the part that differs (the frame) on each variation.
* **Sub-assemblies.** A component can have its own BOM. Costs roll up through any depth, with circular-reference protection.
* **Pricing rules.** Markup %, target margin %, or cost + fixed amount, with rounding (.99, whole, next 5/10/25, 9.99 endings). Store default, per product, per variation.
* **Apply price.** Set the regular price to the computed price from the product screen, or one at a time from the review screen. Sale prices are never touched.
* **Cascade.** Change a component's cost — in the editor, by import, through the REST API, anywhere that writes the cost — and every kit that depends on it is recomputed and flagged "Needs update".
* **Review screen.** WooCommerce → BOM Pricing lists every BOM-priced item with cost, computed price, current price, the change, margin, and why it changed.
* **Works with WooCommerce Cost of Goods.** Read component costs from WooCommerce's own cost field, and write rolled-up costs back to it so its margin reports are right.
* **WP-CLI.** `wp ohbp list`, `wp ohbp rollup`, `wp ohbp set-cost`, `wp ohbp set-bom`, `wp ohbp push`.

= Pro and Business =

[BOM Pricing Pro](https://www.oakhammersoftware.com/bom-pricing/) adds automatic price updates when a component cost changes (with a max-change guard and an optional "only raise prices" rule), bulk apply on the review screen, a full cost and price change history, and CSV cost import by SKU.

The Business plan adds BOM-aware stock: how many more of each kit you can build from parts on hand and which part runs out first, part usage that counts parts consumed by kit sales, a reorder list ranked by what runs out first (with supplier lead times and suggested order quantities), and optional automatic part stock reduction when a kit sells.

= Documentation =

Full guides: [oakhammersoftware.com/bom-pricing/docs](https://www.oakhammersoftware.com/bom-pricing/docs/). In WordPress, go to Plugins → BOM Pricing → Help & feedback to report a problem or suggest a feature.

= Privacy =

BOM Pricing never sends your store's customer, order or product data anywhere. Two things can send information to Oakhammer Software, and only when you choose them:

* **Usage data opt-in (Freemius).** On activation you are asked whether to share basic, non-sensitive diagnostic data: your name and email, site URL, WordPress, WooCommerce and PHP versions, plugin version, language and active plugins/theme. It is handled by [Freemius](https://freemius.com) for Oakhammer Software. Choose "Skip" and nothing is sent; you can opt out later from the plugin's Account page. See the [Freemius privacy policy](https://freemius.com/privacy/) and [ours](https://www.oakhammersoftware.com/bom-pricing/privacy/).
* **Help & feedback form.** Emails your message (and, if you leave the box ticked, your WordPress, WooCommerce, PHP and plugin versions plus counts of BOM-priced items) to Oakhammer Software.

== Installation ==

1. Upload and activate. WooCommerce must be active.
2. Enter unit costs on the parts you buy (General tab for simple products, each variation's pricing fields for variations).
3. On a product you build, open **BOM & Pricing** and add components.
4. Set a store default rule under WooCommerce → Settings → Products → BOM Pricing.

== Frequently Asked Questions ==

= How is this different from a product bundles or composite products plugin? =
Bundle and composite plugins control what the customer picks and how it shows in the cart. BOM Pricing works out what each bundle or kit costs you and what to charge for it, and keeps that price current when part costs change. Kits are ordinary simple or variable WooCommerce products, so you don't need a bundle plugin to sell them.

= Does it show cost of goods and profit margin? =
Yes. Every BOM-priced product and variation shows its rolled-up cost, computed price and margin, and the review screen lists them all. Rolled-up costs can also be written to WooCommerce's own cost of goods field so its reports use them.

= Do components have to be products customers can buy? =
No. Make them private or hidden products. The search includes all statuses.

= Will it change my sale prices? =
No. Only the regular price is set. The review screen warns if a sale price is below cost.

= Can another system update costs? =
Yes. Write the `_ohbp_cost` meta (or WooCommerce's cost field if that's your source) through the WooCommerce REST API or WP-CLI and the cascade runs.

= What happens to my data on uninstall? =
It's kept. Define `OHBP_REMOVE_ALL_DATA` as true in wp-config.php before deleting the plugin to remove it.

== Screenshots ==

1. BOM & Pricing tab: shared parts for every variation of a variable product.
2. A variation's own parts, showing the exact part variation (attributes and SKU), with live cost, computed price and margin.
3. WooCommerce → BOM Pricing: every kit's cost, computed and current price, change, margin, and why it changed.
4. Store-wide defaults under WooCommerce → Settings → Products → BOM Pricing.
5. BOM Stock (Business add-on): what to reorder first, and how many of each kit you can still build.

== Changelog ==

= 0.2.1 =
* Freemius SDK 2.13.5 bundled: optional usage-data opt-in, in-plugin contact form, and the Pro / Business add-on store and licensing.
* Tested with WordPress 7.1 and WooCommerce 11.2.

= 0.2.0 =
* Help & feedback page with in-plugin bug report / feature request form.
* Settings, Review prices, Docs and Help links on the Plugins screen.
* Translation template (languages/oakhammer-bom-pricing.pot).
* Faster admin pages: the "needs attention" count is cached.
* Security hardening: stricter input handling; error messages no longer passed in URLs.
* Tested with WordPress 7.1 and WooCommerce 11.1.
* New `ohbp_summary_after` action for add-ons.

= 0.1.1 =
* Fixed BOM table layout in the variation panel.

= 0.1.0 =
* First release.

== Upgrade Notice ==

= 0.2.1 =
Adds Freemius for optional usage data and Pro / Business licensing. No changes to your BOMs or prices.

= 0.2.0 =
Adds the Help & feedback page and hardens input handling. Recommended for all users.
