Athenian Tax Exemption for WooCommerce
Overview
Product overview
Plugin Name: Athenian Tax Exemption for WooCommerce Primary File: athenian-tax-exemption-for-woocommerce.php Text Domain: athenian-tax-exempt Author: Scott Mays License: GPLv2 or later Declared Version: 1.1.2 Runtime Constant: ATEW_VERSION = 1.1.2 Main Option Key: atew_settings Namespace: ATEW
Athenian Tax Exemption for WooCommerce is a WooCommerce-focused exemption control layer for stores that need reliable tax-exempt handling across customer accounts, user roles, certificates, cart totals, shipping rates, taxable fees, admin orders, REST/headless requests, and multisite role behavior.
The plugin is designed to move tax exemption away from scattered snippets and manual corrections and into a structured workflow: decide who qualifies, optionally document why they qualify, expose admin controls for exceptional cases, and enforce exemption through WooCommerce's tax calculation lifecycle.
---
Use cases
- Tax-exempt customers
- Wholesale accounts
- Order tax review
- Compliance workflows
Developer
Developer starting point
This baseline documents tax-exemption code and WooCommerce hooks. It does not claim a jurisdiction-specific tax result or production checkout outcome.
Admin Workflow
Setup Workflow
- Install and activate the plugin.
- Confirm WooCommerce is active.
- Visit
WooCommerce → Tax Exemption. - Confirm the exempt role slug, usually
tax_exempt. - Choose eligibility methods: role, user meta, certificates, or a combination.
- Choose enforcement mode: recommended
vat_exempt, orzero_rateif the store requires tax-class forcing. - Configure REST override behavior only if needed for integrations or headless checkout.
- Enable logging/debugging during rollout, then reduce logging if not needed.
Customer Approval Workflow
- Open the customer's WordPress user profile.
- Assign the configured exempt role and/or enable the tax-exempt user meta checkbox.
- Upload or select the customer's exemption certificate, if certificate tracking is enabled.
- Enter the certificate expiration date, if applicable.
- Verify the certificate status pill.
- Test the customer in cart/checkout or run a debug probe.
Order Exception Workflow
- Open the WooCommerce order edit screen.
- Use the Tax Exemption metabox.
- Check
Treat this order as tax-exempt. - Save the order.
- Recalculate order totals if needed based on the store's order editing workflow.
- Confirm the order list shows the tax-exempt indicator.
Integration Workflow
- Enable REST header override.
- Configure the trusted header name.
- Choose
eligible_onlyunless the integration is fully trusted and secured. - Send the configured header with a truthy value from the integration.
- Ensure the WooCommerce session/customer context is established where required.
- Confirm exemption behavior in cart/checkout totals.
---
Technical Architecture
File Structure
athenian-tax-exemption-for-woocommerce.php
assets/
admin.css
admin.js
docs/
atew-marketing-document.md
includes/
class-atew-admin.php
class-atew-determiner.php
class-atew-order-admin.php
class-atew-plugin.php
class-atew-settings.phpCore Classes
| Class | File | Responsibility | |---|---|---| | ATEW\Plugin | includes/class-atew-plugin.php | Main runtime bootstrap, WooCommerce hooks, REST override capture, tax enforcement, multisite role sync. | | ATEW\Settings | includes/class-atew-settings.php | Default settings, option retrieval, boolean helper. | | ATEW\Determiner | includes/class-atew-determiner.php | Central exemption and eligibility decision engine. | | ATEW\Admin | includes/class-atew-admin.php | WooCommerce settings page, settings sanitization, assets, user profile fields, debug AJAX. | | ATEW\Order_Admin | includes/class-atew-order-admin.php | Order metabox, order meta persistence, legacy order list column. |
Bootstrap Flow
The main plugin file defines constants, loads class files, and starts the plugin on plugins_loaded priority 5:
add_action('plugins_loaded', function(){
\ATEW\Plugin::instance();
}, 5);The main plugin instance then:
- Registers activation behavior.
- Captures configured REST headers on
initpriority2. - Boots WooCommerce-specific integrations after plugins are loaded.
- Initializes admin and order-admin classes in the dashboard.
WooCommerce Hook Map
| Hook | Type | Purpose | |---|---|---| | woocommerce_customer_is_vat_exempt | Filter | Returns true for exempt customers. | | woocommerce_init | Action | Proactively sets the WooCommerce customer VAT-exempt flag. | | woocommerce_product_get_tax_class | Filter | Forces product tax class in zero-rate mode. | | woocommerce_product_variation_get_tax_class | Filter | Forces variation tax class in zero-rate mode. | | woocommerce_fee_tax_class | Filter | Forces fee tax class in zero-rate mode. | | woocommerce_shipping_rate_tax_status | Filter | Disables shipping tax status for exempt customers. | | woocommerce_shipping_rate_tax_class | Filter | Clears or zero-rates shipping tax class for exempt customers. | | woocommerce_cart_calculate_fees | Action | Marks fees as non-taxable and clears fee tax data. | | woocommerce_package_rates | Filter | Clears tax arrays on shipping rate objects. | | woocommerce_cart_get_taxes | Filter | Clears cart taxes. | | woocommerce_cart_tax_totals | Filter | Clears cart tax totals display data. | | woocommerce_cart_get_shipping_taxes | Filter | Clears shipping taxes. | | woocommerce_cart_shipping_taxes | Filter | Clears shipping taxes. | | woocommerce_cart_totals_get_shipping_taxes | Filter | Clears shipping tax totals arrays. | | woocommerce_cart_totals_get_shipping_tax | Filter | Returns zero shipping tax total. | | woocommerce_after_calculate_totals | Action | Final post-calculation cleanup of cart/shipping tax properties. |
Admin Hook Map
| Hook | Type | Purpose | |---|---|---| | admin_menu | Action | Adds the WooCommerce Tax Exemption submenu. | | admin_init | Action | Registers settings and fields. | | admin_enqueue_scripts | Action | Loads admin CSS/JS and media picker support. | | wp_ajax_atew_debug_probe | Action | Returns current-user exemption diagnostic data. | | show_user_profile | Action | Displays user profile exemption fields. | | edit_user_profile | Action | Displays exemption fields when editing another user. | | personal_options_update | Action | Saves current-user profile exemption fields. | | edit_user_profile_update | Action | Saves edited-user profile exemption fields. | | add_meta_boxes | Action | Adds the order tax exemption metabox. | | save_post_shop_order | Action | Saves order tax exemption meta. | | woocommerce_process_shop_order_meta | Action | Saves order tax exemption meta through legacy WooCommerce order processing. | | manage_edit-shop_order_columns | Filter | Adds the order list Tax Exempt column. | | manage_shop_order_posts_custom_column | Action | Renders the order list status indicator. |
---
Data Model and Settings
Option Key
All plugin settings are stored in:
atew_settingsDefault Settings
| Setting | Default | Purpose | |---|---:|---| | role_slug | tax_exempt | WordPress role slug used for role-based exemption. | | enable_role | 1 | Enables role-based eligibility. | | user_meta_key | _ath_tax_exempt | User meta key used for meta-based eligibility. | | enable_user_meta | 1 | Enables user-meta eligibility. | | enable_certificates | 1 | Enables certificate attachment fields. | | require_valid_certificate | 0 | Requires a valid certificate before exemption is granted. | | cert_meta_id | _ath_tax_exempt_cert_id | User meta key for certificate attachment ID. | | cert_meta_expires | _ath_tax_exempt_cert_expires | User meta key for certificate expiration date. | | enforcement | vat_exempt | Enforcement strategy: vat_exempt or zero_rate. | | zero_rate_tax_class | zero-rate | Tax class slug used in zero-rate mode. | | enable_rest_override | 1 | Enables HTTP header override detection. | | rest_header | X-Ath-Tax-Exempt | Header name used by integrations. | | rest_header_mode | eligible_only | Restricts override to eligible users or allows always-on override. | | enable_order_flag | 1 | Enables order-level exemption flag. | | order_meta_key | _ath_tax_exempt_order | Order meta key for per-order exemption. | | multisite_ensure_role | 1 | Ensures the exempt role exists across multisite contexts. | | multisite_role_sync_members_only | 1 | Syncs role only for users who are already members of a site. | | enable_logging | 0 | Enables WooCommerce logger output under ath-tax-exempt. | | enable_debug_page | 1 | Enables the admin debug panel. |
User Meta
| Meta Key | Default | Purpose | |---|---|---| | Tax-exempt flag | _ath_tax_exempt | Stores yes or no for meta-based eligibility. | | Certificate attachment | _ath_tax_exempt_cert_id | Stores a WordPress attachment ID for the exemption certificate. | | Certificate expiration | _ath_tax_exempt_cert_expires | Stores an optional YYYY-MM-DD expiration date. |
Order Meta
| Meta Key | Default | Purpose | |---|---|---| | Order-level exemption flag | _ath_tax_exempt_order | Stores yes or no for manual per-order exemption. |
Runtime Session Value
| Session Key | Purpose | |---|---| | atew_force_exempt | Stores a request/session-level force flag after a truthy REST header override is captured. |
---
Integration Points
WooCommerce Checkout
The plugin integrates with WooCommerce's native tax-exempt customer flag and then reinforces that decision with cart, shipping, fee, and total-level filters.
WooCommerce Blocks / Store API
The proactive woocommerce_init customer flag update is helpful for flows that read WC()->customer directly, including Blocks or Store API-style checkout behavior.
Customer Service Operations
The user profile fields and order metabox give non-developer staff a controlled way to manage exemption status, documentation, and exceptions.
Finance and Compliance Workflows
Certificate upload and expiration fields provide a lightweight way to associate documentation with account-level exemption status.
Headless Storefronts
REST header override support provides a consistent integration point for custom front ends or connected systems that need to request exemption during checkout.
Multisite Networks
Networked WooCommerce installations can keep the configured role available across sites and reduce role drift for existing site members.
---
Security and Permissions
- Settings access requires
manage_woocommerce. - Debug probe access requires
manage_woocommerceand a valid nonce. - User profile exemption fields require
manage_woocommerce. - Order metabox saves require
edit_shop_orderand a valid nonce. - Settings are sanitized before storage.
- Certificate selection uses the WordPress media library.
- REST/header override should be treated as an integration feature and protected by authentication or trusted request controls.
---
Implementation Review Notes
The codebase is compact, understandable, and purpose-built. The architecture is cleanly separated into settings, determination logic, admin UI, order admin controls, and runtime enforcement.
A few review items should be considered before broad production rollout:
- Shipping tax-status fallback variable: In
filter_shipping_rate_tax_status(), the non-exempt branch returns$status, but the method parameter is named$tax_status. This should be corrected to return$tax_statusto avoid an undefined variable notice or incorrect fallback behavior. - HPOS support: Order admin functionality currently targets legacy
shop_orderscreens and may need HPOS-compatible order metadata and admin UI support for stores fully migrated to custom order tables. - Order flag recalculation: The order-level metabox stores the exemption flag, but existing order tax totals may still need an explicit recalculation workflow depending on how the order is edited. The
order:{id}context is available for custom code paths. - REST override caution:
rest_header_mode = alwaysshould only be used when the calling system is authenticated and trusted, because it can bypass normal user eligibility. - Certificate validation policy: The plugin validates the presence and expiration of a certificate attachment, but it does not inspect the legal contents of the certificate. Operational review is still required.
---
Install
- Reviewed source folder: athenian-tax-exemption
- Plugin version reviewed: 1.1.2
- Local source inventory: 31 files (temporary, test, and Git metadata excluded).
- GitHub baseline: https://github.com/Athenian-Brands/athenian-tax-exemption at baseline/devdocs-1.1.2-20261006c / a5d10a3d5dbbc29d9041dbf97b91a2472a536837.
- WordPress and WooCommerce.
- Jurisdiction rules, checkout totals, tax-provider behavior, and legal compliance require separate verification.
Configuration
- Plugin Identity — see the linked technical reference excerpt.
- Executive Summary — see the linked technical reference excerpt.
- Marketing Positioning — see the linked technical reference excerpt.
- Key Value Propositions — see the linked technical reference excerpt.
- Best-Fit Use Cases — see the linked technical reference excerpt.
- Feature Overview — see the linked technical reference excerpt.
- Admin Workflow — see the linked technical reference excerpt.
- Technical Architecture — see the linked technical reference excerpt.
- Data Model and Settings — see the linked technical reference excerpt.
- Eligibility and Enforcement Logic — see the linked technical reference excerpt.
- Developer Notes — see the linked technical reference excerpt.
- Integration Points — see the linked technical reference excerpt.
- Security and Permissions — see the linked technical reference excerpt.
- Compatibility Notes — see the linked technical reference excerpt.
Usage
- Shortcodes detected in local PHP source: 0
- Static action/filter hooks detected in local PHP source: 34
- REST route registrations detected in local PHP source: 0
Shortcodes
- No static add_shortcode registrations were detected by the baseline scanner.
REST Endpoints
- No register_rest_route calls were detected by the baseline scanner.
Hooks
- add_meta_boxes — includes/class-atew-order-admin.php
- admin_enqueue_scripts — includes/class-atew-admin.php
- admin_init — includes/class-atew-admin.php
- admin_menu — includes/class-atew-admin.php
- edit_user_profile_update — includes/class-atew-admin.php
- edit_user_profile — includes/class-atew-admin.php
- init — includes/class-atew-plugin.php
- manage_edit-shop_order_columns — includes/class-atew-order-admin.php
- manage_shop_order_posts_custom_column — includes/class-atew-order-admin.php
- personal_options_update — includes/class-atew-admin.php
- plugins_loaded — athenian-tax-exemption-for-woocommerce.php
- plugins_loaded — includes/class-atew-plugin.php
- profile_update — includes/class-atew-plugin.php
- save_post_shop_order — includes/class-atew-order-admin.php
- show_user_profile — includes/class-atew-admin.php
- user_register — includes/class-atew-plugin.php
- woocommerce_after_calculate_totals — includes/class-atew-plugin.php
- woocommerce_cart_calculate_fees — includes/class-atew-plugin.php
- woocommerce_cart_get_shipping_taxes — includes/class-atew-plugin.php
- woocommerce_cart_get_taxes — includes/class-atew-plugin.php
- woocommerce_cart_shipping_taxes — includes/class-atew-plugin.php
- woocommerce_cart_tax_totals — includes/class-atew-plugin.php
- woocommerce_cart_totals_get_shipping_taxes — includes/class-atew-plugin.php
- woocommerce_cart_totals_get_shipping_tax — includes/class-atew-plugin.php
- woocommerce_customer_is_vat_exempt — includes/class-atew-plugin.php
- woocommerce_fee_tax_class — includes/class-atew-plugin.php
- woocommerce_init — includes/class-atew-plugin.php
- woocommerce_package_rates — includes/class-atew-plugin.php
- woocommerce_process_shop_order_meta — includes/class-atew-order-admin.php
- woocommerce_product_get_tax_class — includes/class-atew-plugin.php
- woocommerce_product_variation_get_tax_class — includes/class-atew-plugin.php
- woocommerce_shipping_rate_tax_class — includes/class-atew-plugin.php
- woocommerce_shipping_rate_tax_status — includes/class-atew-plugin.php
- wp_ajax_atew_debug_probe — includes/class-atew-admin.php
Data Model
- Data Model and Settings — described in the local technical reference.
- Integration Points — described in the local technical reference.
API Reference
- Local source digest: 2c5f44819bdd470c198f0535e2b8ddf319306e17459ee328be9269033af54fa8
- Repository URL: https://github.com/Athenian-Brands/athenian-tax-exemption
- Repository reference: baseline/devdocs-1.1.2-20261006c
- Repository commit: a5d10a3d5dbbc29d9041dbf97b91a2472a536837
Source files include: .editorconfig, .gitattributes, .github/CODEOWNERS, .github/ISSUE_TEMPLATE/bug_report.yml, .github/PULL_REQUEST_TEMPLATE.md, .github/workflows/ci.yml, .gitignore, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md, README.md, SECURITY.md, assets/admin.css, assets/admin.js, athenian-tax-exemption-for-woocommerce.php, athenian-tax-exemption-for-woocommerce.png, athenian-tax-exemption-icon.png, docs/atew-marketing-document.md, docs/athenian-platform-marketing.md, docs/athenian-platform-technical.md, docs/technical-marketing.md, includes/class-atew-admin.php, includes/class-atew-determiner.php, includes/class-atew-order-admin.php, includes/class-atew-plugin.php, includes/class-atew-settings.php, readme.txt, release-manifest.json, …
Troubleshooting
- This baseline documents tax-exemption code and WooCommerce hooks. It does not claim a jurisdiction-specific tax result or production checkout outcome.
- Confirm the deployed plugin version, active dependencies, and current repository tree before using implementation details as a release contract.
Treat payment, carrier, vendor, shipment, inventory, account, credential, tax, AI, and external-provider behavior as integration-dependent until exercised in the target environment.
FAQ
What is this page intended to establish?
A versioned, product-linked starting point for iterative developer documentation. It combines the local implementation reference with a detected-code inventory and a committed GitHub baseline.
Is the linked repository baseline verified?
Yes. The repository URL, ref, and commit recorded on this page were verified from the clean GitHub baseline prepared for this documentation pass. That does not by itself prove fleet deployment parity.
What remains for release-grade documentation?
Reconcile the recorded source baseline with the deployed plugin version, then exercise the relevant authenticated, store, provider, payment, tax, carrier, or generated-artifact paths in the target environment.