DPTag is extended through ordinary WordPress hooks. They are the seams the Pro add-on attaches to, and they are open to any plugin. The free plugin carries nothing in a disabled state behind them: where a hook has no listener, the free behaviour is the whole behaviour.
All hooks are prefixed dptag_. Add a listener with add_filter() or
add_action() from a plugin loaded after DPTag; the add-on hooks itself on
plugins_loaded at priority 20 for that reason.
Templates and detection
dptag_templates (filter). The registered sector templates, keyed by
sector. Add a key with a label, a groups array of fields and an optional
detect block of categories, attributes and keywords signals. Each
field takes label, type (text, textarea, country, number,
materials), required, and optionally help and defaultable. See
sector templates.
dptag_default_template (filter). The key used when nothing else
applies. Receives the first registered key and all templates.
dptag_detect_sector (filter). The detected sector of a product.
Receives the winning key, the WC_Product, the per-template scores and the
best score, which is zero when no signal matched. Return another key to
override.
Public page
dptag_passport_themes (filter). The palettes offered under Passports,
then Passport page. A theme is [ 'label' => string, 'colors' => [ key => '#RRGGBB' ] ] with the colour keys of the built-in themes; unknown keys are
dropped and missing ones fall back to the default. The composition bar is a
chart: keep a wide luminance spread between the ramp's ends so its segments
stay readable without colour, and measure a new palette with
tools/check-themes.php from the plugin's repository.
dptag_passport_brand_mark (filter). Replace the brand name on the page
with an image. Return [ 'url' => string, 'width' => int, 'height' => int ],
or an empty array to keep the text. Receives the passport payload, so the
mark can vary per passport.
dptag_passport_cache_key (filter). Extra material for the page's cache
validator. Anything a plugin puts on the page must be able to invalidate the
copies browsers hold; return a string that changes when your contribution
changes, a URL usually.
Admin screens
dptag_qr_actions (action). Fires beside the PNG download of a QR code,
with a context of passport (the editor's box) or product-list (the
products list dialog). Print extra controls; the module grid of the code is
published as window.dptagQrModel for another renderer to walk, so a second
format is the same code.
dptag_appearance_after_themes (action) and dptag_appearance_save
(action). The first fires inside the form of the Passport page screen, after
the theme list, with the active theme id; the second fires when that form is
saved, nonce and capability already checked. Render a control in one, read it
from $_POST in the other.
dptag_wizard_welcome_takeover (filter) and
dptag_wizard_welcome_render (action). Return true from the filter to
replace the wizard's first step with your own, then render it in the action.
dptag_wizard_header_actions (action) fires beside the title of steps 2
to 4 with the step number, for a way out of the manual path.
dptag_is_pro_active (filter). Return true to tell the Upgrade screen a
Pro licence is active, so it stops selling what the user has. It adapts copy
only and gates nothing.
AI
dptag_ai_request_auth (filter). Credentials attached to an AI request.
Empty by default, which is the free per-site sample; return
[ 'key' => $license_key ] to bill the run to an account. Receives the
completion arguments. What a plugin returns is merged over a key typed on
the AI credits screen.
dptag_ai_product_input (filter). The product text sent to the AI, one
Label: value line per block, with the WC_Product. Append a line for data
held elsewhere, in a custom field for instance, so the AI can read it. Keep
it short and factual; it is prompt input, not markup.
dptag_ai_after_complete (action). Fires after a successful AI response
with the decoded result, which includes the quota or sample counters. Used
to persist a credit balance for a meter.
dptag_ai_meter (filter). The markup of the credit meter shown under the
AI buttons. Receives the free-sample meter; return your own. The result is
passed through wp_kses().
dptag_ai_quote_slot (action). Fires under the run buttons of the batch
panels with the number of products the run would fill. Render a cost
estimate there.
dptag_ai_batch_takeover (filter) and
dptag_ai_batch_takeover_actions (action). Return true from the filter,
which receives the product count and whether Pro is active, to replace the
free plugin's foreground batch loop with your own run; then render your
control in the action. The shared progress bar stays in place for you to
drive.
dptag_api_base (filter). The base URL of the AI service, for a
development environment.
Conventions
Hooks are stable once published: a parameter is added at the end, never
removed or reordered. Prefixes, option names and meta keys in the plugin all
start with dptag; the plugin's own code never reads another plugin's
options, and the same is asked of a plugin reading DPTag's, which are not an
API. The public API of the data is the REST route.