Guide

Product Configurator hooks

The core plugin fires roughly 400 hooks. They are grouped here by what they affect rather than by type, because that is how you will look for them — you know you want to change something in the cart, or in the configurator's markup, long before you know whether the hook you need is an action or a filter.

In this section

  • Frontend templates — the Underscore templates the configurator renders from: layers, choices, toolbar, summary, viewer.
  • Product page and assets — the Configure button, script and style loading, and the data handed to the browser.
  • Cart and orders — how a configuration is priced, displayed and stored once it leaves the configurator.
  • Data and configuration — the data layer: choices, layers, angles, settings, global configurators, images.
  • Admin — the configurator editor, settings screens and product admin.
  • JavaScript — frontend — the configurator running in the browser.
  • JavaScript — admin — the configurator editor running in the browser.

For the 3D viewer, see The 3D runtime API, which exposes a live object rather than a hook list.

Which mechanism to use

The configurator does most of its work in the browser. A configuration is assembled client-side from data printed into the page, and only becomes server state when it is added to the cart. That shapes which hook you need:

If you want to change…Use
The markup a choice or layer renders asA template hook
What a choice does when clickedA frontend JavaScript hook
The data the browser starts fromData and configuration
Prices, cart display, order metaCart and orders
The editor a shop manager usesAdmin or admin JavaScript

A common mistake is to filter a choice's name in PHP and wonder why the configurator still shows the old one. The configurator renders from PC.fe.currentProductData, so a change that must be visible while configuring belongs either in the data that is printed (mkl_pc_get_configurator_data) or in a JavaScript filter — not in the cart-display hooks, which run much later.

Hook naming in core

PrefixMeaning
mkl_pc_…The original PHP convention; most core hooks
mkl_pc/…Newer PHP hooks, grouped path-style
mkl/pc/…A few older PHP hooks kept for compatibility
tmpl-…PHP hooks that print into an Underscore template
PC.fe.…Frontend JavaScript
PC.admin.…, PC.app.…Admin JavaScript
PC.choices.…Choice selection logic, shared by both

See the hook reference index for the mechanics of registering PHP and JavaScript callbacks, and for what Internal means on a hook.