Skip to main content

AvaTax โ€” Sales Tax Calculation

Scottsdale Mint uses Avalara AvaTax for real-time, address-validated sales tax calculation at checkout. Precious metals have complex tax rules that vary significantly by state โ€” AvaTax handles these automatically.


Why AvaTax for Precious Metals?โ€‹

Sales tax on precious metals is a complex, state-by-state patchwork:

State ExampleTax Treatment
ArizonaExempt โ€” bullion above threshold
TexasExempt โ€” qualified bullion
CaliforniaTaxable โ€” some exemptions for large purchases
New YorkPartially exempt (depends on product type)

Avalara's AvaTax maintains an up-to-date database of tax rules and applies them automatically based on:

  • Customer's shipping address
  • Product's ItemCode / tax code
  • Purchase amount

This eliminates manual maintenance of a 50-state tax table.


Integration Methodโ€‹

The site uses the WooCommerce AvaTax plugin (by Avalara or a compatible connector). The plugin:

  1. Intercepts WooCommerce's tax calculation
  2. Calls the AvaTax REST API with order details
  3. Returns calculated tax amounts
  4. Stores the tax transaction reference for future auditing

Tax Calculation Flowโ€‹

Customer changes shipping address at checkout
โ”‚
โ–ผ
JavaScript triggers AJAX: get_cart_totals or wc_checkout
โ”‚
โ–ผ
WooCommerce calls AvaTax plugin tax hook
โ”‚
โ–ผ
AvaTax plugin calls Avalara REST API:
- FROM: Scottsdale Mint address (Phoenix, AZ)
- TO: Customer shipping address
- Lines: Product SKU, quantity, amount, tax code
โ”‚
โ–ผ
Avalara responds with:
- Tax amount per line
- Jurisdiction codes
- Effective tax rates
โ”‚
โ–ผ
Displayed to customer on checkout

Product Tax Codesโ€‹

Products must be assigned Avalara commodity codes to enable precious metals exemptions:

CommodityAvalara Tax Code
Gold bullion coin/barP0000000 (or bullion-specific code)
Silver bullion coin/barP0000000
Numismatic coinsPS080101 (collectibles)
Non-bullion jewelryStandard tangible goods

Tax codes are stored in WooCommerce product meta (_avaTax_tax_code) and managed via the plugin's product settings.


Configurationโ€‹

ENV VariableDescription
AVATAX_ACCOUNT_NUMBERAvalara account number
AVATAX_LICENSE_KEYAvalara license key
AVATAX_COMPANY_CODEAvalara company code (SCOTTSDALEMINT or similar)
AVATAX_ENVsandbox or production

Dev / Staging Behaviorโ€‹

important

In development and staging environments, AVATAX_ENV=sandbox must be set. The sandbox does not bill real tax transactions but may return slightly different tax amounts than production.

If AvaTax sandbox calls fail in development (no network access):

  • The AvaTax plugin falls back to WooCommerce's built-in tax rates (stored in the DB)
  • Enable fallback in plugin settings: WooCommerce โ†’ AvaTax โ†’ Fallback to WooCommerce rates

Tax-Exempt Customersโ€‹

Some customers qualify for sales tax exemption certificates:

  • Registered dealers
  • Businesses purchasing for resale
  • State-specific exemptions

These customers have an exemption certificate stored in their Avalara account. The WooCommerce AvaTax plugin checks the customer's avatax_exempt_code user meta and passes it in API calls to zero out tax.


Transaction Commitsโ€‹

AvaTax transactions are committed when an order is placed. Each order generates a Document Code in Avalara equal to the WooCommerce order number. This document code is stored on the order for audit retrieval.


Admin Retrievalโ€‹

Admins can view tax calculations for each order:

  1. WooCommerce โ†’ Orders โ†’ [Order]
  2. Scroll to AvaTax metabox
  3. View Avalara Document Code, jurisdiction, and tax breakdown

Troubleshootingโ€‹

IssueAction
Tax not calculating at checkoutCheck AVATAX_ACCOUNT_NUMBER and AVATAX_LICENSE_KEY are set; check Avalara sandbox vs prod
Tax showing as 0 for all statesProduct tax code may be exempt โ€” check product's _avaTax_tax_code
AvaTax timeout errorsAvalara API may be down; check Avalara status page; ensure Lambda has internet access
Tax showing incorrectly on stagingVerify AVATAX_ENV=sandbox; sandbox may have slightly different rates than production