Filters — both editions
The free edition applies two of the full edition's filters under the same names, so code written for either edition works with both.
gmgst_hsn
The HSN or SAC code a product goes on an invoice under, after the plugin's own lookup.
| Argument | Type | |
|---|---|---|
$code |
string |
Digits, or '' |
$product_id |
int |
The product |
$variation_id |
int |
The variation, or 0 |
// Every gift card is a service under SAC 9997.
add_filter( 'gmgst_hsn', function ( $code, $product_id ) {
return has_term( 'gift-cards', 'product_cat', $product_id ) ? '9997' : $code;
}, 10, 2 );
gmgst_record
The GST record about to be frozen onto an order. Return an array; its keys are merged over the plugin's.
| Argument | Type | |
|---|---|---|
$record |
array |
gstin, seller_gstin, seller_state, place, kind (intra/inter), split, lines |
$order |
WC_Order |
The order |
If you change lines, keep split equal to their sum — the invoice prints both.
Filters — Full edition
| Filter | What it changes |
|---|---|
gmgst_export_statuses |
The order statuses the GSTR-1 export reads; default processing, completed |
gmgst_settings |
The settings array, merged over the defaults |
gmgst_modules |
The module list the plugin boots |
gmgst_license_api_url |
The licence API base |
gmgst_update_cache_ttl |
How long an update answer is cached |
Order meta
Written on woocommerce_checkout_create_order (classic checkout) or woocommerce_store_api_checkout_update_order_from_request (Checkout block).
| Key | Value |
|---|---|
_gmgst_gstin |
The customer's GSTIN, only when one passed its check |
_gmgst_seller_gstin |
Your GSTIN at the time |
_gmgst_seller_state |
Your state code at the time |
_gmgst_place_of_supply |
The state code of the place of supply |
_gmgst_kind |
intra or inter |
_gmgst_split |
cgst, sgst, igst, total |
_gmgst_lines |
Each line: name, hsn, qty, taxable, rate, cgst, sgst, igst, total |
_gmgst_invoice_no |
The formatted invoice number, once drawn |
_gmgst_invoice_year |
Its financial year, e.g. 2026-27 |
$order = wc_get_order( $order_id );
$split = $order->get_meta( '_gmgst_split' );
$igst = is_array( $split ) ? (float) $split['igst'] : 0.0;
HSN codes
- Product and variation meta
_gmgst_hsn(both editions). - Full edition: product category term meta
_gmgst_hsn.
Invoice series
One option per financial year, gmgst_series_<year> (for example gmgst_series_2026-27), holding the last number drawn. Shared by both editions and never deleted by either. A number is drawn on woocommerce_order_status_processing and woocommerce_order_status_completed (priority 20) for an order carrying a GST record, and stored in _gmgst_invoice_no.
Checkout fields
- Classic checkout: billing field
gmgst_gstin. - Checkout block: additional field
gatemi-gst/numberin the address location; WooCommerce stores it as_wc_billing/gatemi-gst/numberon the order. The state rule runs onwoocommerce_blocks_validate_location_address_fieldsfor the billing group, because a field's own validate callback never sees the state. - Variation panel: field
_gmgst_hsn_variation[], saved onwoocommerce_save_product_variationas_gmgst_hsnon the variation.
Print and export routes
Both are admin-only, require the edit_shop_orders capability and the nonce gmgst_print:
- Print:
admin.php?gmgst_doc=invoice&gmgst_orders=12,13,14&_wpnonce=…(20 orders at most in the free edition, 100 in the full edition). - Full edition export:
?gmgst_export=1&gmgst_from=YYYY-MM-DD&gmgst_to=YYYY-MM-DD&_wpnonce=…streamsgstr1-<from>-to-<to>.csv.
The bulk action key is gmgst_invoice on both order screens.
Order totals rows
woocommerce_get_order_item_totals gains gmgst_cgst, gmgst_sgst, gmgst_igst (each only when non-zero) and gmgst_gstin.
CSS classes on the invoice
The invoice page links its own print stylesheet. Classes worth styling: .gmgst-doc (the page), .gmgst-invoice (one invoice), .gmgst-invoice--none (an order with no record), .gmgst-seller, .gmgst-buyer, .gmgst-seller-gstin, .gmgst-buyer-gstin, .gmgst-supply, .gmgst-kind, .gmgst-lines, .gmgst-hsn, .gmgst-missing (a line with no code), .gmgst-num, .gmgst-grand (the invoice total) and .gmgst-note (full edition).
On the order screen's GST box: .gmgst-order-place, .gmgst-order-gstin, .gmgst-order-missing, .gmgst-order-print.
