tax-and-shipping
Skill1 starsChanged 18 days agoMITView on GitHub
Calculate tax and shipping from the destination and the store's configured rules, and store the breakdown on the order. Use when changing tax classes, shipping zones, rates, or the amount shown before payment.
In this repository28 other files it gives its agents.
- b2b-pricingSkill
- catalog-import-and-migrationSkill
- checkout-ux-and-conversionSkill
- conversion-event-trackingSkill
- ecommerce-seo-structured-dataSkill
- fraud-and-risk-basicsSkill
- google-merchant-product-feedsSkill
- headless-nextjs-storefrontSkill
- inventory-and-multi-warehouseSkill
- iranian-payment-gatewaysSkill
- marketplace-search-and-rankingSkill
- mcp-store-toolingSkill
- multi-vendor-payoutsSkill
- order-and-webhook-reliabilitySkill
- payment-gateway-integrationSkill
- product-catalog-modelingSkill
- product-description-guardrailsSkill
- returns-and-refundsSkill
- rtl-and-persian-localizationSkill
- shopify-app-developmentSkill
- storefront-accessibilitySkill
- storefront-performanceSkill
- stripe-paymentsSkill
- subscription-billingSkill
- vector-product-searchSkill
- woocommerce-plugin-developmentSkill
- woocommerce-rest-apiSkill
- wordpress-plugin-securitySkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Keep the rate id that was used.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tax and shipping
Use this skill when an order needs a tax or shipping amount. Checkout display is the checkout skill. Payment capture uses the total this skill produced. Do not invent a tax rate. A rate comes from the store's configuration or from a tax service the store has enabled.
Procedure
- Decide the tax address from the store's tax setting: destination, shop base, or the service's rule. Do not assume every country taxes the shipping address.
- Resolve each line to a tax class. Shipping may be taxed separately from goods.
- Calculate tax in integer minor units. Store each tax line: name or rate id, rate, and amount. Record whether prices are entered inclusive of tax.
- Resolve shipping from the destination to a zone, then to the methods the shopper can choose. Quote those rates before payment.
- Recalculate when the address, the line items, or the selected method changes. The total you charge is the last server calculation, not the first estimate.
WooCommerce mapping is in the WooCommerce notes. Worked examples and checks are in evals/tasks.json.
Tax
- A missing rate is an error or a zero-rated class the merchant configured. It is not a silent 0% you made up.
- Inclusive and exclusive prices do not mix on one order. If the catalog is inclusive, the line price already contains tax and the tax line is the included portion.
- Discounts reduce the taxable base according to the store's setting (before tax or after). Apply that setting once.
- Digital and physical lines can have different classes. Do not put one rate on the order header and ignore the lines.
- Keep the rate id that was used. A later change to the rate table must not rewrite historical orders.
Shipping
- Zones are matched from the most specific address you have. Quoting a domestic rate before the country is known is an estimate and must be replaced.
- A free method is a configured rate of zero. An address with no zone is not free shipping. Show that you cannot ship there.
- The selected method's id and the quoted amount are stored on the order. Changing the label later does not change the amount already charged.
- Multi-vendor shipments use one rate per merchant policy. The payout skill records who receives the shipping amount. This skill only calculates what the shopper pays.
Presentation
- Show shipping, tax, and the grand total before the pay control.
- A second currency is a display conversion. The tax and shipping amounts you persist use the order currency.
- Round each tax line with the currency's minor units, then sum. Do not sum binary floats and round once at the end if the platform's tax API already defines the rounding.
Gotchas
- Calculating tax only in the browser lets a modified client submit a lower total. Recalculate on the server.
- Caching a shipping quote without the address, the items, and the method id will reuse another shopper's rate.
- Tax-exempt customers need an explicit exemption on the customer or the order. Skipping tax because a field was blank marks everyone exempt.
- Refunds refund tax in proportion to the refunded lines, using the tax that was stored, not today's rate table.
Verification
- Two addresses in different zones produce the rates configured for those zones, including a zone that does not ship.
- An order stores tax lines that add up to the tax total, in the order currency.
- Changing the address on checkout updates the quoted shipping and tax before payment.
- A historical order keeps its original tax amounts after you edit the live rate table.
Evaluation
Worked examples and the checks they must satisfy are in evals/tasks.json.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

