Skip to content

Developer reference

PressFlow PHP hooks: complete V2 reference

All eleven emitted custom hooks, callback arguments, return contracts and safe examples.

PressFlow 3.0.0 · 4 min read

Guide source reviewed for PressFlow 2.0.5.

PressFlow emits the following eleven literal custom PHP hooks in release 2.0.5. WordPress/WooCommerce hooks used internally are separate from this list. Register site customisations in a small site plugin or child theme; do not edit the distributed plugin.

Hook contracts

HookTypeCallback argumentsPurpose and return contract
pfw_b2b_credit_storage_readyactionint $company_idObserve legacy company-credit storage conversion reaching its ready state before the queued commercial reconciliation.
pfw_features_updatedactionarray $previous, array $currentObserve a successful central feature-settings save. Arrays contain effective booleans.
pfw_from_price_hooksfilterarray $placementsReturn the placement map. single/catalog entries have hook and priority; use null for an entry to omit it. Runs at init.
pfw_from_price_valuesfilter?array $values, WC_Product $product, array $configReturn explicit configuration values, or retain null to use the configured bounded starting-price search.
pfw_from_price_htmlfilterstring $html, WC_Product $product, ?array $result, string $contextReturn starting-price HTML. result is null when there is no valid priced starting reference.
pfw_launch_additional_checksfilterarray $checks, array $profileReturn up to 30 additional Ready to sell check records. Profile has production, audience and suppliers.
pfw_production_stagefilter?string $stage, WC_Order $order, WC_Order_Item_Product $itemReturn null for ordinary PressFlow stage resolution, or a recognised stage label key for an integration-owned state.
pfw_quote_createdactionint $quote_id, array $snapshotObserve creation of a quote with its saved specification snapshot.
pfw_order_item_snapshotactionWC_Order_Item_Product $item, array $snapshotObserve the core print snapshot being applied to an order item. It can run again during normal checkout synchronisation.
pfw_tradeprint_artwork_updatedactionint $product_id, array $previous_checks, array $current_checksObserve a saved change to supplier-product artwork checks.
pfw_tradeprint_settingsfilterarray $settingsReturn the merged Tradeprint settings array. This includes operational configuration and can contain sensitive connection-related values.

Move the starting price

<?php
add_filter('pfw_from_price_hooks', static function (array $places): array {
    $places['single'] = [
        'hook' => 'woocommerce_single_product_summary',
        'priority' => 8,
    ];
    return $places;
});

Set the relevant single/catalog entry to null if your template renders the full starting block itself. Use pressflow_from_price() or its shortcode once; never copy a placeholder product price into a From offer. Placement filters must be registered before the plugin's init placement callback.

Add a local setup check

<?php
add_filter('pfw_launch_additional_checks', static function (array $checks, array $profile): array {
    $checks[] = [
        'key' => 'shop_artwork_contact',
        'title' => 'Artwork contact setting',
        'detail' => 'Review the shop artwork contact in your site settings.',
        'status' => 'review',
        'url' => admin_url('options-general.php'),
    ];
    return $checks;
}, 10, 2);

The check describes a local review requirement. It does not certify that email, payment or a supplier connection works.

Action and filter boundaries

  • pfw_b2b_credit_storage_ready: Not a payment event or permission to release credit. Let normal reconciliation and locks finish; do not write balances directly.
  • pfw_features_updated: No-op when your feature did not change. Do not reinterpret a UI switch as price/payment authorisation.
  • pfw_from_price_hooks: Change placement only; retain a genuine starting configuration and a single visible From label.
  • pfw_from_price_values: Values still pass the engine. Do not return a display amount, nominal base price or an unbounded configuration enumeration.
  • pfw_from_price_html: Keep paired VAT, wrappers, specification context and quote/configure prompts. Escape added content.
  • pfw_launch_additional_checks: Each record needs key, title, detail, status; url is optional and must remain inside the local admin origin/path. Status: action, review, checked, recorded, unused or information. Use settings/status checks; do not send mail, order from suppliers or claim a live test passed.
  • pfw_production_stage: This is an advanced stage override. Never force ready/printing/dispatched to bypass payment, credit, artwork, proof or supplier readiness. It is not an order submission API.
  • pfw_quote_created: Queue idempotent downstream work. Keep contact, artwork and private quote data out of public logs.
  • pfw_order_item_snapshot: The item can be unsaved. Use WooCommerce CRUD and idempotent observers; do not duplicate payments, orders or external notifications.
  • pfw_tradeprint_artwork_updated: Invalidate your own derived artwork mapping if necessary; do not submit an order or reuse old artwork approval.
  • pfw_tradeprint_settings: Preserve unrelated settings. Never log/export the array, loosen supplier gates or expose credentials to the browser.

Hook callback signatures are versioned with this release. Class internals, private metadata and queue callback names are not promises of a permanent public API. Test your extension on the exact release and installed checkout/storage combination you support.

See shortcodes, VAT and offers, checkout integration, company security and extension 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.