Developer reference
Job data, snapshots, private files and security boundaries
Read WooCommerce records safely and keep internal storage and authorisation separate from public APIs.
Guide source reviewed for PressFlow 1.25.1.
These storage names describe the current release for diagnostics and versioned integrations. They are not a supported write API. Prefer the shop's normal UI/workflows for mutations; editing internal metadata can bypass review, invalidate approvals or lose index/notification updates.
Current data map
| Location | Role |
|---|---|
Product meta _pfw_config | Saved print configuration. |
Product meta _pfw_layout | Optional product-specific layout. |
Product meta _pfw_auto_coupon | Explicit automatic public promotion code. |
Basket item pfw | Configured job data; basket quantity remains one. |
Order item meta _pfw_snapshot | Captured job specification/calculation context. |
Private pfw_quote post type | Quote requests and related offer/contact data. |
Prefixed pfw_artwork database table | Private retained file storage. |
Prefixed pfw_jobs database table | Derived production index. |
pfw_appearance, pfw_settings, pfw_licence options | Presentation, shop settings and private activation state. |
Use the WordPress table prefix rather than assuming wp_. Do not include licence records, artwork bytes, private contacts or access credentials in public exports.
Read a historical job through CRUD
<?php
defined('ABSPATH') || exit;
function myshop_pressflow_job_snapshots(int $order_id): array {
if (!function_exists('wc_get_order') || !current_user_can('manage_woocommerce')) {
return [];
}
$order = wc_get_order($order_id);
if (!$order) {
return [];
}
$jobs = [];
foreach ($order->get_items('line_item') as $item_id => $item) {
$snapshot = $item->get_meta('_pfw_snapshot', true);
if (is_array($snapshot) && $snapshot) {
$jobs[(int) $item_id] = $snapshot;
}
}
return $jobs; // Staff-only internal result; escape/allowlist any later output.
}
Snapshots include plugin version, configuration hash, currency, prices_include_tax, capture time and derived artwork requirements alongside the calculation result. Historical job data does not become a current catalogue price when a product changes. Do not reinterpret an old amount using today's tax-entry basis.
HPOS-compatible code uses WooCommerce order/item CRUD, not get_post_meta($order_id) or direct order-post SQL. The derived queue can be rebuilt from source jobs in batches; it is not the authoritative place to write production decisions.
Authorisation
Staff operations require capabilities and relevant object permissions. Account workspaces require ownership. Guest access uses bound private credentials and additional current-state checks. A valid nonce without ownership is insufficient. Never implement a download route that accepts only an order/item ID or a billing email.
Proof/current-artwork fingerprints, stale-version checks, production locks and transactional/concurrency controls matter. A replacement artwork set must not inherit an old clearance. A held job that has already printed must not become editable merely because its visible stage says hold.
Private files and external links
Retention expiry removes stored file bytes through scheduled cleanup. It does not clear every historical backup. Temporary chunk uploads expire separately. Artwork transfer links are recorded, not fetched; avoid introducing a server-side fetch without a separate authorised and secure design.
Exclude private routes/cookies from caches and logs where possible. Redact tokens from diagnostics. Guest links can expose access if copied into analytics, referrers or publicly visible notes.
Related: Storage, Caching/cron, Developer testing.
Example files
Reference examples for adapting to your shop. PHP examples are not plugin installers; review the guide and replace sample IDs before using them.
Need a hand?
Contact the PressFlow team with details of what you are trying to do.