=== CookiePrime Sold by Weight ===
Contributors: samirprime
Tags: woocommerce, weight, checkout, ecommerce, produce
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.0.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sell products by exact weight. The customer orders an estimate; you enter the actual weight at fulfillment and the order total is updated.

== Description ==

CookiePrime Sold by Weight is built for butchers, fishmongers, delis, coffee roasters, produce stands, spice shops, and any merchant selling by exact weight.

Standard e-commerce charges a fixed price at checkout. But a "1 lb steak" is never exactly 1 lb. This plugin closes that gap.

**How it works:**

1. Mark any product as "Sold by exact weight" and set its price per unit (e.g. $15.00 / lb).
2. The customer orders an estimated quantity (e.g. quantity 2 = about 2 lbs).
3. The cart and checkout show "Estimated:" totals with a clear notice that the final price will be confirmed after weighing.
4. After checkout, the order moves to "Awaiting Weight."
5. When the product is weighed, the merchant enters the actual weight in the Weight Station.
6. The plugin recalculates the order total based on the actual weight.
7. The customer receives an email confirming the final total.

**Features:**

* Mark any WooCommerce product as "Sold by exact weight"
* Per-unit price display (e.g. $15.00 / lb)
* "Estimated:" labels in cart and checkout
* Cart and checkout notices explaining that the total is an estimate
* Decimal quantity support (2.5 lbs, not just 2)
* Weight Station for entering actual weights
* Automatic order total recalculation
* Final weight confirmation email sent to the customer
* Works with offline payment methods (Cash on Delivery, Bank Transfer, Check)
* No external service or API key required

**Card / Stripe support is currently in development.** For more information — including early access and updates — contact us at **contact@cookieprime.com**.

The plugin does not require any external account, license, or subscription. Everything runs locally inside your WordPress installation.

For more information about our e-commerce tools, visit https://cookieprime.com.

== Payment method support ==

This version of the plugin is designed for **offline payment methods** — Cash on Delivery, Bank Transfer, and Check. With these methods, the order total is set on the order itself after the merchant weighs the product. No money is collected at checkout, so the final total is always correct.

**If you accept card payments with this version:**

The customer is charged the **estimated amount** at checkout, before the product is weighed. The final weight-adjusted total cannot be adjusted automatically. This may result in a small difference between what the customer paid and what the actual weight was worth.

**Card payment support with an authorize-then-capture flow is currently in development.** If you accept card payments and need the final total to be captured exactly, please contact us at **contact@cookieprime.com** for more information.

== Installation ==

= Step 1 — Install and activate =

1. Install and activate WooCommerce (if not already installed).
2. Install and activate CookiePrime Sold by Weight.

= Step 2 — Configure a product =

1. Go to **Products → Add New** (or edit an existing product).
2. Set the **Regular price** to your price **per unit** (e.g. `15` for $15/lb).
3. In the **Product data → General** tab, check the box **"Sold by exact weight"**.
4. Set the **Weight unit** (lb, oz, kg, or g).
5. Click **Publish** or **Update**.

= Step 3 — Take an order =

1. A customer adds the weight product to the cart.
2. They choose a quantity that represents the weight they want (e.g. quantity 2 = 2 lbs estimated).
3. The cart and checkout show "Estimated:" totals with a notice.
4. They complete checkout using an offline payment method (Cash on Delivery, Bank Transfer, or Check).
5. The order moves to **Awaiting Weight**.

= Step 4 — Weigh and finalize =

1. Go to **Weight Station** in the WordPress admin menu.
2. The order appears as a card. Click it.
3. Enter the **actual total weight** per line (e.g. 2.15).
4. Click **Finalize Order**.
5. The plugin recalculates the total and updates the order.

== Frequently Asked Questions ==

= What happens if the actual weight is different from the estimate? =

The plugin recalculates the order total based on the actual weight you enter in the Weight Station, using your store's normal tax and rounding rules. The customer is sent an email showing the final line items and the final order total.

= Does this work with card payments? =

Not yet. Card and Stripe support is currently in development. This version is designed for offline payment methods — Cash on Delivery, Bank Transfer, and Check. For more information, including early access and updates, contact **contact@cookieprime.com**.

= Can I sell other products on the same store? =

Yes. Only products marked "Sold by exact weight" trigger the Weight Station flow. All other orders process as normal WooCommerce orders.

= Can I customize the final weight email? =

Yes. The email uses WooCommerce's standard email system. Go to **WooCommerce → Settings → Emails → "Final weight confirmed"** to enable or disable it, and to edit its subject line and heading.

= What if I uninstall the plugin? =

Order metadata and weight entries are preserved as financial records. Configuration options are deleted.

== Screenshots ==

1. Product edit screen showing the "Sold by exact weight" option.
2. Weight Station — orders awaiting weights.
3. Cart showing "Estimated:" totals and the notice.

== Changelog ==

= 1.0.5 =
* Improved: readme now clarifies offline payment method support and card/Stripe support status.
* Improved: contact email updated to contact@cookieprime.com.

= 1.0.4 =
* Added: dedicated "Final weight confirmed" email sent to the customer after the merchant finalizes the order. Editable under WooCommerce → Settings → Emails.

= 1.0.3 =
* Fixed: products marked as "Sold by exact weight" before the rename were not detected after the rename. The plugin now reads both the current and legacy meta keys.
* Fixed: orders placed with Cash on Delivery, Bank Transfer, or Check were not being moved to "Awaiting Weight".

= 1.0.2 =
* Renamed to "CookiePrime Sold by Weight" and slug to "cookieprime-sold-by-weight".
* All internal prefixes updated to cpsbw for compliance with the WordPress.org plugin guidelines.
* Removed the license-gated Stripe integration. The plugin is now fully functional on its own with any payment method.
* Requires PHP bumped to 8.0.
* Readme updated to reflect actual functionality.

= 1.0.1 =
* Internal compliance and stability fixes.

= 1.0.0 =
* Initial release.