=== Advanced Shipping Rate Builder – Table Rate, Conditional & Weight Based Shipping ===
Contributors: actpro, freemius
Tags: table rate shipping, conditional shipping, shipping rules, weight based shipping, woocommerce shipping
Requires Plugins: woocommerce
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Table rate shipping for WooCommerce — conditional and weight based shipping rules, a visual builder, cart simulator and free shipping progress bar.

== Description ==

**Advanced Shipping Rate Builder** is a table rate shipping plugin for WooCommerce. It lets you build exactly the rates your store needs — table rate shipping, conditional shipping, weight based shipping and free shipping — and *see* what customers will pay before they do.

Set up **table rate shipping** by cart total, weight or item count. Add **conditional shipping** rules that only apply to certain products, categories or shipping classes. Charge **weight based shipping** per kilogram, or a percentage of the order. All from one visual rule builder, with no code.

Every rule reads as a sentence: **WHERE** (which WooCommerce zones) → **WHEN** (conditions) → **THEN** (what to charge) → **SHOW AS** (the label at checkout). A live plain-language summary restates the whole rule as you edit, and the built-in **Simulator** runs any test cart through the real engine, showing which rules matched, which were skipped and exactly why.

= Why merchants choose it =

Most shipping plugins make you guess. This one shows you the answer before your customer sees it: a live checkout preview while you edit, and a simulator that runs your real rules against any test cart. "Why didn't my rule apply?" stops being a support ticket.

= Build rates from =

* Flat cost, cost per item, cost per weight, or percentage of the cart subtotal
* Tiered extras — add amounts per quantity, weight or subtotal range (up to 5 tiers)
* A free-shipping threshold on any rule ("free when the cart total reaches …")

= Target rules by =

* Your existing **WooCommerce shipping zones** — no duplicate location setup, ever
* Cart subtotal, cart weight, item quantity
* Products, product categories, shipping classes

= Merchant-friendly by design =

* **Goal-first creation** — pick what you want ("free shipping over an amount", "weight-based rate", …) and get a working rule to adjust
* **Rule simulator** — answer "why didn't my rule apply?" in seconds, not support tickets
* **Free-shipping progress bar** on cart and checkout ("Add €12.50 more for free shipping"), classic and block carts alike
* Clear resolution: show all matching rates (customer picks) or highest-priority only — stated in plain words on the dashboard
* Rules never break checkout: a misconfigured rule is skipped and flagged in the dashboard, never fatal

= Lightweight & modern =

* Rules live in one indexed table — no post-meta bloat, one query per checkout calculation
* Zero frontend assets unless the progress bar is shown
* HPOS compatible, works with classic and Block cart/checkout
* REST API and WP-CLI (`wp wpactpro-sr rules …`) included

= Pro =

The free plugin does everything above. [Advanced Shipping Rate Builder Pro](https://wpactpro.com/shipping-rate-builder/) adds conditions for **customer role** (wholesale and B2B pricing), **date window** (seasonal and holiday rates), **day of week**, **time window** and **coupon applied**, plus OR condition groups so one rule can match several different carts.

Every rule you build in the free version keeps working if a licence lapses — you can still edit, simplify and delete them.

== Installation ==

1. Install and activate **WooCommerce** first — this plugin extends it and will not activate without it.
2. Upload the plugin through **Plugins → Add New → Upload Plugin**, or install it from the WordPress plugin directory.
3. Activate it through the **Plugins** screen.
4. Go to **WooCommerce → Shipping Rules** and pick a goal to create your first rule.

No shipping zone setup is required. Rules use the WooCommerce shipping zones you already have, so your countries, states and postcodes stay where you configured them.

= Building from source =

The admin interface in `build/` is compiled from the React source in `client/`, both of which ship with the plugin. To rebuild it:

`npm install && npm run build`

== Frequently Asked Questions ==

= Can I set up table rate shipping in WooCommerce? =

Yes. Build a table rate by adding tiers to any rule — different prices for each cart total, weight or quantity range (for example 0–5 kg, 5–20 kg, 20 kg and up). Tiers can add a flat amount once, or multiply per item, per kilogram or per unit of subtotal.

= Does it support weight based shipping? =

Yes. Charge a cost per weight unit, add weight-range tiers, or use cart weight as a condition so a rule only applies above or below a given weight. The weight unit follows your WooCommerce settings.

= How do I create conditional shipping rules? =

Add conditions to a rule and it only applies when they all match. You can condition on cart subtotal, cart weight, item quantity, and whether the cart contains particular products, product categories or shipping classes.

= How do I offer free shipping over a certain amount? =

Set a free-shipping threshold on any rule — "free when the cart total reaches …". Turn on the progress bar and shoppers see "Add $12.50 more for free shipping" on the cart and checkout, updating live as they shop.

= Can I hide other shipping methods when my rule applies? =

Yes. Any rule can hide the other shipping methods a customer would otherwise see, so a matching rate becomes the only option. It never leaves a customer with no shipping option at all — if no rate from this plugin applies, the others stay.

= How does this relate to WooCommerce shipping zones? =

Rules target your existing zones ("All zones" or a selection). Destination matching — countries, states, postcodes — stays in WooCommerce where you already configured it. This plugin never re-implements geography.

= What happens when several rules match the same cart? =

Your choice, stated on the dashboard: show every matching rate so the customer picks (default), or apply only the highest rule in your list. The Simulator always shows the final outcome.

= Does it work with the Cart and Checkout Blocks? =

Yes — rates flow through the Store API automatically, and the progress bar renders on block carts with live updates. The classic cart and checkout are equally supported.

= Will it slow my store down? =

No. Rules load in a single indexed query, results are object-cached, and the frontend ships zero JavaScript/CSS unless the progress bar is actually displayed.

= Can I charge different shipping rates per product or category? =

Yes. Condition a rule on the cart containing particular products, product categories or shipping classes, then set the rate for that rule. A common setup is a shipping class for bulky items with its own higher rate.

= Can I offer multiple shipping rates for one order? =

Yes. By default every matching rule offers its rate and the customer picks at checkout. Switch to highest-priority-only if you would rather present a single option.

= Does it replace the WooCommerce flat rate shipping method? =

No, it sits alongside it. Your existing flat rate, free shipping and local pickup methods keep working. If you want a rule to be the only option a customer sees, turn on "hide other shipping methods" for that rule.

= Can I set a maximum or minimum order weight for shipping? =

Yes. Use cart weight as a condition — "at least" or "at most" a given weight — so a rule only offers its rate inside that range. Carts outside it simply do not get that rate.

= Can I manage rules from the command line? =

Yes: `wp wpactpro-sr rules list|create|delete`.

== Screenshots ==

1. Settings — show every matching rate and let the customer pick, or apply only the highest rule
2. Rule builder — WHERE / WHEN / THEN / SHOW AS, with a live plain-language summary of the rule
3. Free shipping over an amount — set the threshold and the rate becomes free above it
4. Category surcharge — charge extra when the cart contains the products or categories you choose
5. Cart — the free-shipping progress bar tells shoppers exactly how much more to add
6. Checkout — your rule's label and rate, as the customer sees them
7. Simulator — every rule run against a test cart, showing which matched and why the rest did not
8. Conditions — stack cart subtotal, weight, item count, products, categories and shipping classes
9. Operators — includes or excludes, at least or at most, so one condition covers either direction

== Changelog ==

= 1.1.0 =
* Initial release.
* Rule engine with zone-aware shipping method — table rate, conditional, weight based and free shipping rules.
* Visual rule builder: WHERE / WHEN / THEN / SHOW AS, with a live plain-language summary and 10 goal templates.
* Rules dashboard with drag-to-reorder priority, live checkout preview and global save.
* Simulator — run any test cart through the real engine and see which rules matched, which were skipped and why.
* Condition groups: a rule can match on any of several groups — for example, "cart weight over 10 kg" OR "contains the Fragile category" — instead of only every condition at once. Adding a second group is a Pro feature; everything else here is free.
* Tiered extras (up to 5 tiers per rule) by quantity, weight or subtotal range.
* Free-shipping progress bar on cart and checkout, classic and block alike.
* Conditions on cart subtotal, cart weight, item quantity, products, product categories and shipping classes.
* Extension API: add-ons can register condition types, resolution modes and lookup sources, and the builder renders text, dropdown, multi-select, date and time conditions straight from their schema.
* REST API and WP-CLI (`wp wpactpro-sr rules …`).
* HPOS compatible; works with the classic and Block cart/checkout.
