Skip to content

Developer reference

Extend the print basket and checkout safely

Understand exact-job controls, scalar metadata, the Store API extension and refresh events.

PressFlow 3.0.0 · 3 min read

Guide source reviewed for PressFlow 2.0.5.

Ownership and optional presentation

The print_checkout feature controls the print-focused skin on existing cart and checkout pages. The body gains .pfw-print-flow when a PressFlow job is present. The print review mount is [data-pfw-order-review]. A Dock-only basket does not become a native PressFlow job review.

The plugin retains WooCommerce's native address, shipping, coupon, payment, terms and order-submit controls. Extensions must keep their native handlers and validation. Avoid copying calculated totals into a separate custom payment form.

Store API contracts

The pressflow_order_review CartSchema namespace returns has_print, cart_html and checkout_html for the current basket. Rich basket controls are inert templates inside cart_html, matched to an opaque hash of each exact basket key. The script appends its own leaf container to recognised native/classic rows, without replacing their existing form fields.

PressFlow item metadata remains separate scalar values for both initial PHP preloading and later REST responses. Its entries include raw_key and className. WooCommerce has used both span and list wrappers; do not depend on a li element or put complex interactive HTML into item_data. Other extensions' metadata remains intact. The published cartItemClass filter adds the print-line class while preserving existing classes.

The existing CartItemSchema pressflow namespace describes copies and complete-job quantity. These display extensions do not authorise item edits or uploads. A refresh payload is private session data and must not enter a public page/API cache.

Refresh behaviour

Blocks read the namespaced cart extension from the WooCommerce cart store. Classic checkout can use the nonce-protected pfw_checkout_review read endpoint. Older responses are ignored; native customer field nodes/values are retained. Open specifications and relevant control focus survive review refreshes. A failed read offers Retry print review.

Browser eventMeaning
pressflow:cart-artwork-savedExisting cart artwork saved successfully. detail.key identifies the basket job.
pressflow:order-review-updatedPrint review presentation changed. No purchase or upload is authorised by this event.
pressflow:vat-changeCatalogue/configurator display mode changed; detail.mode is excl/incl. Checkout uses WooCommerce's actual tax display.
pfw:pricedBubbles from a configurator after a validated response; detail is the price result. Treat it as display data rather than an authority to submit a job.

These events coordinate presentation. They must not independently submit a supplier order, reserve company credit, mark payment received or accept a proof.

Styles and acceptance

Use .pfw-basket-tools, .pfw-inline-spec, .pfw-print-review-job and the existing appearance tokens for narrow presentation extensions. Keep hidden content hidden and focus visible. Native complete-job quantities remain one; ordinary products retain their editable quantities.

Test initial non-REST page load, AJAX refreshes, artwork-save races, two jobs from one product, a mixed basket, removed jobs, theme border rules and narrow screens. Test payment and B2B gateway methods on the actual installed checkout. See print checkout and 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.