REST API & Admin Interface

REST endpoint

GET /wp-json/lh-woocommerce-pdf-invoicing/v1/invoice/{order_id} generates and streams a PDF invoice for the specified order.

Authentication: Standard WordPress REST API authentication — cookie+nonce (?_wpnonce=...), application passwords, or any other WP REST auth method.

Permission:

Response: Binary PDF (Content-Type: application/pdf) with Content-Disposition: attachment.

HTTP StatusReason
401Not logged in
403Logged in but order belongs to a different customer
404Order ID not found

Admin interface

PDF Invoice metabox

A PDF Invoice metabox appears in the side column of every WooCommerce order edit screen, containing a Download PDF Invoice button that links directly to the REST endpoint with a wp_rest nonce. Requires the install_plugins capability.

Order actions dropdown

A Download PDF Invoice entry is available in the WooCommerce order actions dropdown. Selecting it and clicking Update redirects the admin to the REST download URL. Requires the install_plugins capability.

My Account orders screen

A Download Invoice button appears alongside the standard order action buttons on the customer’s My Account → Orders screen, visible to the order’s own customer only.

Constants

ConstantDescription
LH_WOOCOMMERCE_PDF_INVOICING_VERSIONCurrent plugin version string
LH_WOOCOMMERCE_PDF_INVOICING_FILEAbsolute path to the main plugin file
LH_WOOCOMMERCE_PDF_INVOICING_DIRAbsolute path to the plugin directory (trailing slash)