=== GSTLayer ===
Contributors: jasmeetsaini
Tags: gst invoice, woocommerce gst, hsn code, gstin, india
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

GST invoice for WooCommerce: CGST, SGST and IGST rates, HSN codes, buyer GSTIN at checkout, PDF tax invoices and HSN reports, all on your own server.

== Description ==

GSTLayer makes a WooCommerce store GST-ready for India. It builds the CGST + SGST/UTGST and IGST tax rates for every slab, puts HSN and SAC codes on products, collects and validates the buyer's GSTIN at checkout, numbers tax invoices in a per-year series and generates the Rule 46 PDF invoice on your own server. No order, customer or product data is sent to any third party, and nothing in the free plugin is locked behind an upgrade.

**Free, for every GST-registered store**

* **One-click GST tax rates** – creates WooCommerce tax classes for 0 / 5 / 12 / 18 / 28 % (or your own slabs) with CGST + SGST/UTGST for your state and IGST for every other state.
* **HSN / SAC codes** on products, variations and categories, with sensible inheritance.
* **Buyer GSTIN at checkout** – works with both the Checkout block and the classic checkout; format and check-digit validation; stored on the order and the customer profile.
* **Place of supply & supply type** detected per order (intra-state vs inter-state vs export) with warnings when the charged tax does not match.
* **Sequential tax-invoice numbers** per financial year (Rule 46 compliant pattern such as INV/26-27/0001), issued automatically when an order reaches the status you choose and never renumbered.
* **PDF tax invoice** (Rule 46 layout, your logo, amount in words) attached to order emails, downloadable from the order confirmation page, My Account and the admin order screen.
* **GST panel on every order** showing taxable value, CGST, SGST/UTGST, IGST, Cess and HSN per line.
* **HSN summary report** for any date range, exportable as CSV in the GSTR-1 HSN sheet layout.
* **Bill of Supply** layout for composition-scheme suppliers.
* **Privacy first** – no external requests, no tracking, no accounts.

**GSTLayer Pro** (a separate plugin sold on the GSTLayer website) adds the filing side: GSTR-1 section CSVs in the GST Returns Offline Tool layout, a GSTR-3B outward-supplies summary and credit notes on refunds.

= Privacy =

GSTLayer makes no outbound HTTP requests, loads nothing from external servers and collects no usage data. Generated PDFs are stored in a protected folder inside your uploads directory. All data can be removed on uninstall (Settings → GST → Advanced).

= Bundled libraries =

PDF rendering uses dompdf (LGPL-2.1) with the DejaVu Sans font (Bitstream Vera licence); both are GPL-compatible and included unmodified under `vendor/`.

== Installation ==

1. Upload the plugin or install it from the WordPress plugin directory and activate it. WooCommerce must be active.
2. Go to **WooCommerce → Settings → GST → Supplier** and enter your legal name, GSTIN, address and State / UT.
3. Open the **Tax rates** section and click **Create GST tax rates**.
4. Edit each product: set **Tax class** to the matching GST slab and enter its **HSN / SAC code** (or set a default per category).
5. Place a test order. The order screen shows the GST panel; the tax invoice number is assigned when the order reaches Processing or Completed.

== Frequently Asked Questions ==

= Does this send my orders anywhere? =
No. Everything runs inside your WordPress installation. The plugin makes no HTTP requests.

= Can I use my existing WooCommerce tax rates? =
Yes. GSTLayer only manages rates inside its own `gst-*` tax classes. Existing rates whose names are CGST, SGST, UTGST or IGST are recognised on invoices and in the HSN report.

= Does it work with the new WooCommerce block checkout and HPOS? =
Yes. GSTIN and legal-name fields are registered through the Additional Checkout Fields API for the block checkout and as billing fields for the classic checkout. Order data is stored through the WooCommerce CRUD so High-Performance Order Storage is fully supported.

= Which supply type is used for Union Territories? =
Chandigarh, Ladakh, Lakshadweep, Andaman & Nicobar and Dadra & Nagar Haveli and Daman & Diu levy UTGST; the plugin labels the state component accordingly. Delhi, Puducherry and Jammu & Kashmir use SGST.

= Does GSTLayer do e-invoicing (IRN, QR code)? =
Not at present. E-invoicing is mandatory above ₹5 crore aggregate turnover; stores below that issue ordinary tax invoices, which GSTLayer generates. An IRP integration is on the roadmap but not promised for a date.

= Is this legal or tax advice? =
No. GSTLayer applies the GST rules described in its documentation; confirm your setup (place of supply basis, slabs, HSN codes) with your chartered accountant.

== Screenshots ==

1. Supplier settings with GSTIN check-digit validation (WooCommerce → Settings → GST).
2. One-click GST tax rates: a WooCommerce tax class per slab with CGST + SGST/UTGST and IGST rows.
3. HSN / SAC code on the product data panel.
4. GSTIN and business-name fields in the WooCommerce Checkout block, with CGST and SGST shown in the order summary.
5. GST panel on the order screen: place of supply, buyer GSTIN, HSN-wise taxable value and tax, issued invoice number and PDF buttons.
6. The generated PDF tax invoice (Rule 46 layout with logo, HSN, CGST/SGST or IGST and amount in words).

== Changelog ==

= 0.2.2 =
* The invoice styles are now a stylesheet file (assets/css/invoice.css) loaded into the PDF engine; the invoice template no longer contains a style block. Themes that override the template keep working; the 'gstlayer_invoice_stylesheet' filter replaces the file.
* Security hardening: product, variation and category HSN fields verify the form nonce and the user's permission themselves; the HSN report's date filter is nonce-protected.
* Result messages of GSTLayer actions are shown once to the user who ran the action, and the "requires WooCommerce" notice appears only on the Plugins screen.
* The customer invoice link always requires the order's secret key.

= 0.2.1 =
* Accessibility: tables on the order GST panel, the tax-rate status and the HSN report now have header scopes and captions for screen readers.
* Accessibility: item names in the order GST panel are read out, not only shown on hover; a missing HSN is announced.
* Accessibility: the invoice download and preview links name their document and say when they open a new tab.
* Accessibility: stronger colour contrast for status labels; field help is shown as text instead of hover tooltips.
* Accessibility: the invoice logo picker keeps keyboard focus when the logo is removed and announces changes.
* Accessibility: GSTIN format hint on the classic checkout; descriptive label on the My Account invoice link.
* The plugin website link points to the GSTLayer store.

= 0.2.0 =
* Version submitted for WordPress.org review: readme, screenshots, Plugin Check pass.
* Extension points for GSTLayer Pro: generic document issuing (credit notes), `source_id` column on the invoice register, reusable GST line computation, template renderer, settings-section filters and an order meta-box hook.
* Fix: the "Create GST tax rates", "Issue tax invoice now" and "Recalculate" buttons and the report date filter were nested inside WooCommerce's own form and did not submit; they are now nonce-protected links and buttons.
* Fix: invoice dates printed one day late for invoices issued after 18:30 IST (timezone conversion).
* Fix: export invoices could not be registered (`supply_type` column too short for "export").
* Fix: rebuilding GST tax rates no longer loses the rate percentage of earlier orders — the order's own tax lines are used.

= 0.1.0 =
* First development release: settings, tax-rate builder, HSN fields, checkout GSTIN, per-order breakdown, invoice numbering, PDF tax invoice with logo, customer downloads and email attachment.

== Upgrade Notice ==

= 0.2.2 =
First public release on WordPress.org.
