Saudi Arabia's ZATCA Phase 2 e-invoicing mandate is one of the most technically demanding compliance requirements I've encountered in WooCommerce development. It's not just generating a PDF — it's UBL 2.1 XML, XAdES-BES digital signatures, a cryptographic hash chain, TLV-encoded QR codes, and real-time API submission to government servers. Here's how I built FatooraPro, a WooCommerce plugin that handles the full ZATCA Phase 2 flow. What ZATCA Phase 2 Actually Requires Every invoice must: Be generated as UBL 2.1 compliant XML Be digitally signed with XAdES-BES using a ZATCA-issued certificate Include a TLV-encoded QR code with 8 specific fields Maintain a hash chain (each invoice's hash references the previous one) Be submitted to ZATCA's API — either for clearance (B2B) before delivery, or reporting (B2C) within 24 hours Miss any of these and the invoice is legally invalid. The Two Invoice Types Standard Tax Invoice (B2B — Clearance) Submitted to ZATCA before the invoice is delivered to the buyer.…