Cookbook
Each recipe here is a single route file: one problem, one package, one file pushed with lps api push. They all build on two Loopress Full features, Custom API Routes and Composer dependency management, and on the mechanism connecting them, covered in Composer Packages in a WordPress REST API Route. Read that first if verb methods, permission(), Composer autoloading, or failure isolation are new.
Browse by category in the sidebar.
Documents & Files
- Exporting WooCommerce Orders to XLSX with PhpSpreadsheet
A Custom API Route that turns a WooCommerce orders query into a downloadable Excel file, using PhpSpreadsheet, for the client who just wants "the numbers in a spreadsheet."
- Generating a Ticket QR Code from a WordPress Route with Endroid QR Code
A Custom API Route that renders a scannable QR code for an event ticket on request, using endroid/qr-code, instead of generating and storing an image file per ticket sold.
- Rendering a WordPress Post as a Downloadable PDF
A Custom API Route that turns any published post's rendered content into a PDF on request, using dompdf, for a "Download as PDF" button that doesn't need a plugin.
Search & Data Services
- Query ACF Fields with GraphQL, in Your Own API Route
A Custom API Route that answers GraphQL queries against ACF fields deployed by Loopress, using webonyx/graphql-php, without installing a full GraphQL plugin.
- Typo-Tolerant Instant Search in WooCommerce with Algolia
Index a WooCommerce catalog into Algolia with a Hook, then query it straight from a React single-page app using algolia/algoliasearch-client-php and the official Algolia JS client.