Guide

Admin hooks

The configurator editor a shop manager works in, the plugin's settings screens, and the product admin. The most valuable hooks here are the settings filters — they add fields to layers, choices, angles and 3D objects, and those fields then flow all the way to the frontend.

See the hook reference index for how to register callbacks.

Layer, choice, angle and 3D object fields

HookTypeArgumentsPurpose
mkl_pc_choice_default_settingsfilter$fieldsFields on a choice
mkl_pc_choice_settings_sectionsfilter$sectionsSections those fields group into
mkl_pc_layer_default_settingsfilter$settingsFields on a layer
mkl_pc_layer_settings_sectionsfilter$sectionsSections for layer fields
mkl_pc_angle_default_settingsfilter$settingsFields on an angle
mkl_pc_angle_settings_sectionsfilter$sectionsSections for angle fields
mkl_pc_object3d_default_settingsfilter$settingsFields on a 3D object
mkl_pc_layer_typesfilter$typesAvailable layer types
mkl_pc_display_modesfilter$modesAvailable layer display modes
mkl_pc_object3d_item_typesfilter$typesAvailable 3D object types
mkl_pc_3d_settings_sectionsfilter$sectionsSections in the per-product 3D settings

Editor markup

HookTypeArgumentsPurpose
mkl_pc_choice_fieldsaction(none)Inside the choice settings template
mkl_pc_layer_fieldsaction(none)Inside the layer settings template
mkl_pc_layer_settingsaction(none)Inside the layer settings panel
mkl_pc_angle_fieldsaction(none)Inside the angle settings template
mkl_pc_angle_settingsaction(none)Inside the angle settings panel
mkl_pc_object3d_fieldsaction(none)Inside the 3D object settings template
mkl_pc_object3d_settingsaction(none)Inside the 3D object settings panel
mkl_pc_admin_objects3d_add_tilesaction(none)Extra tiles on the "add 3D object" screen
mkl_pc_layers_toolbar_dropdownaction(none)Items in the layers toolbar dropdown
mkl_pc_layers_toolbar_dropdown_topaction(none)Items at the top of it
mkl_pc_admin_templates_beforeaction(none)Before the admin templates are printed
mkl_pc_admin_templates_afteraction(none)After they are
tmpl-mkl-pc-setting--repeateraction(none)Inside a repeater field template
tmpl-mkl-pc-setting--repeater-optionaction(none)Inside one repeater row

Product admin screens

HookTypeArgumentsPurpose
mkl_pc_admin_home_tabaction(none)The configurator's Home tab
mkl_pc_admin_home_actionsfilter$actions, $id, $productAction buttons on it
mkl_pc_admin_home_actions_afteraction$id, $productAfter those buttons
mkl_pc_admin_general_tabaction(none)The General tab
mkl_pc_admin_general_tab_before_start_buttonaction(none)Before its start button
mkl_pc_admin_instructions_before_contentaction$id, $productBefore the instructions block
mkl_pc_admin_instructions_afteraction$idAfter it
mkl_pc_admin_documentation_contentaction$id, $productThe documentation panel
mkl_pc_admin_global_configurator_contentaction$id, $productThe global configurator panel
mkl_wc_general_metaboxe_classesfilter$classesClasses on the general metabox
mkl_pc_admin_scriptsfilter$scriptsEditor scripts to enqueue
mkl_pc_admin_scripts_product_pageaction(none)After they are enqueued
PC_langfilter$langThe strings and config passed to the editor

Settings screens and menu

HookTypeArgumentsPurpose
mkl_pc_settings_tabsfilter$tabs, $activeTabs on the settings page
mkl_pc_settings_before_tabsaction$activeBefore the tab bar
mkl_pc_settings_content_afteraction$activeAfter the tab content
mkl_pc/register_settingsaction$settingsPageRegister settings of your own
mkl_product_configurator_admin_menufilter$menuThe admin menu definition
mkl_pc_admin_menuaction$menuSlugAfter the menu is registered
mkl_pc_admin_icon_registryfilter$iconsSVG icons available to the editor
mkl_pc_addons_catalogfilter$addonsThe add-ons listed on the Add-ons tab
mkl_pc_addon_card_actionsfilter$html, $addon, $isInstalledButtons on an add-on card
mkl_pc_addons_tab_beforeaction(none)Before the Add-ons tab content
mkl_pc_theme_color_settingsfilter$settingsTheme colour settings
mkl_pc_them_color_variablesfilter$rulesCSS custom properties they produce
mkl_pc_customizer_settingsaction$wpCustomize, $thatCustomizer settings
mkl_pc_customizer_settings_beforeaction$wpCustomize, $thatBefore them

Orders in the admin

HookTypeArgumentsPurpose
mkl_pc_admin_order_itemaction$layerBeside a configured layer on an order
mkl/order/admin_meta/display_valuefilter$value, $orderItem, $configuratorDataThe configuration shown on an order
mkl/order/override_saved_metafilter$overrideWhether to replace the stored meta display

3D model uploads

HookTypeArgumentsPurpose
mkl_pc_3d_should_unzip_attachmentfilterfalse, $attachmentId, $fileWhether to unzip an uploaded archive
mkl_pc_3d_allowed_zip_extensionsfilter$extensionsExtensions allowed inside it
mkl_pc_3d_max_zip_bytesfilter$bytes, $attachmentIdLargest archive accepted
mkl_pc_3d_max_extracted_bytesfilter$bytes, $attachmentIdLargest extracted size accepted
mkl_pc_3d_max_zip_filesfilter$count, $attachmentIdMost files accepted
mkl_pc_3d_premium_addon_urlfilter$urlWhere the 3D Premium upsell links

mkl_pc_choice_default_settings

The most-used hook in the whole plugin. It declares the fields a shop manager sees on a choice, and anything you add is stored with the choice, printed into the frontend data, and available in templates as data.your_field.

php functions.php
add_filter( 'mkl_pc_choice_default_settings', function ( $fields ) {	$fields['_general']['fields']['supplier_code'] = array(		'label'    => __( 'Supplier code', 'my-plugin' ),		'type'     => 'text',		'priority' => 130,	);	return $fields;}, 30 );
mkl_pc_choice_default_settings.

Field types are text, number, textarea, checkbox, select and html. A condition expression shows a field only for certain layer types.

Adding custom data to choices works through this from end to end, including how to display the value on the frontend.

A field added here is not automatically saveable. The data layer has its own allowlist — add the same key to mkl_pc_db_fields or the value is dropped on save.

mkl_pc_layer_default_settings and mkl_pc_angle_default_settings

The same pattern for layers and angles.

php functions.php
add_filter( 'mkl_pc_layer_default_settings', function ( $settings ) {	$settings['_general']['fields']['internal_note'] = array(		'label'    => __( 'Internal note', 'my-plugin' ),		'type'     => 'textarea',		'priority' => 200,	);	return $settings;} );
mkl_pc_layer_default_settings and mkl_pc_angle_default_settings.

The *_settings_sections filters

Sections are the collapsible groups fields sit in. Add one before adding fields to it:

php functions.php
add_filter( 'mkl_pc_choice_settings_sections', function ( $sections ) {	$sections['_fulfilment'] = array(		'id'          => 'fulfilment',		'label'       => __( 'Fulfilment', 'my-plugin' ),		'priority'    => 90,		'collapsible' => true,		'fields'      => array(),	);	return $sections;} );
Sections are the collapsible groups fields sit in. Add one before adding fields to it.

Core reserves _general, _threed and _translations. Priorities run from 10 upwards; 3D sits at 20 and translations at 140.

mkl_pc_layer_types and mkl_pc_display_modes

layer_types is the list a shop manager picks from — simple, multiple, group, form, summary, text_overlay. Add-ons add their own here.

php functions.php
add_filter( 'mkl_pc_layer_types', function ( $types ) {	$types['my_type'] = __( 'My layer type', 'my-plugin' );	return $types;} );
mkl_pc_layer_types and mkl_pc_display_modes.

Adding an entry only puts it in the dropdown. You also need a frontend view for it — see PC.fe.layer.beforeRenderChoices, which is how Multiple Choice and Text Overlay substitute theirs.

mkl_pc_object3d_item_types and mkl_pc_3d_settings_sections

The kinds of object a 3D configurator can hold — gltf, light, environment, environment_hdri, environment_cubemap, animation — and the sections of the per-product 3D settings panel.

3D Premium registers its AR and postprocessing sections at priority 20. Without the add-on, core registers placeholder sections in their place at priority 15. Core forces the reset section last at 100. Use a priority below 100 or your section lands after the reset button.

PC_lang

Everything the editor's JavaScript reads: labels, defaults, type lists, the icon registry, 3D decoder paths. Filter it to add data your own admin scripts need.

php functions.php
add_filter( 'PC_lang', function ( $lang ) {	$lang['my_plugin'] = array( 'endpoint' => admin_url( 'admin-ajax.php' ) );	return $lang;} );
PC_lang.

mkl_pc_admin_scripts and mkl_pc_admin_scripts_product_page

The filter takes the list of editor scripts before they are registered — the supported way to inject a script into the editor's dependency chain. The action fires afterwards, for anything that must load later.

php functions.php
add_action( 'mkl_pc_admin_scripts_product_page', function () {	wp_enqueue_script( 'my-editor-extras', '…', array( 'mkl_pc/js/admin' ), '1.0', true );} );
mkl_pc_admin_scripts and mkl_pc_admin_scripts_product_page.

mkl_pc/register_settings

Fires with the settings page object, which is where you register settings of your own rather than filtering the defaults.

php functions.php
add_action( 'mkl_pc/register_settings', function ( $settings_page ) {	// $settings_page exposes the plugin's own registration API.} );
mkl_pc/register_settings.

Pair it with mkl_pc_settings_tabs to give them a home:

php functions.php
add_filter( 'mkl_pc_settings_tabs', function ( $tabs, $active ) {	$tabs['my_tab'] = __( 'My settings', 'my-plugin' );	return $tabs;}, 10, 2 );
Pair it with mkl_pc_settings_tabs to give them a home.

mkl_pc_admin_home_actions and …_after

Buttons on the configurator's Home tab — the natural place for "import", "duplicate", or a link into your own tooling.

php functions.php
add_filter( 'mkl_pc_admin_home_actions', function ( $actions, $id, $product ) {	$actions[] = '<a class="button" href="' . esc_url( my_export_url( $id ) ) . '">'		. esc_html__( 'Export', 'my-plugin' ) . '</a>';	return $actions;}, 10, 3 );
mkl_pc_admin_home_actions and …_after.

mkl_pc_admin_order_item and mkl/order/admin_meta/display_value

The first prints beside each configured layer on an order screen, receiving the MKL\PC\Choice. The second filters the whole rendered configuration.

php functions.php
add_action( 'mkl_pc_admin_order_item', function ( $layer ) {	if ( $code = $layer->get_choice( 'supplier_code' ) ) {		echo ' <code>' . esc_html( $code ) . '</code>';	}} );
mkl_pc_admin_order_item and mkl/order/admin_meta/display_value.

3D archive upload limits

A shop manager can upload a .zip containing a glTF model and its textures. The limits are deliberately tight, because extraction happens on the server:

php functions.php
add_filter( 'mkl_pc_3d_max_zip_bytes', function ( $bytes, $attachment_id ) {	return 200 * MB_IN_BYTES;}, 10, 2 );
3D archive upload limits.

mkl_pc_3d_allowed_zip_extensions is the allowlist of what may be extracted, and mkl_pc_3d_max_extracted_bytes guards against zip bombs — an archive that is small until it is not. Raise these only as far as you actually need, and never widen the extension list to include anything executable.

mkl_pc_3d_should_unzip_attachment decides whether an archive is processed at all; returning false leaves the upload as an inert file.

mkl_pc_addons_catalog and mkl_pc_addon_card_actions

The add-ons listed on the Add-ons tab, and the buttons on each card. Useful for an agency shipping its own extensions alongside the official ones.

Theme colours

mkl_pc_theme_color_settings declares the colour settings a merchant sees; mkl_pc_them_color_variables turns them into CSS custom properties. (The second name is misspelled in core and kept that way for compatibility.)

php functions.php
add_filter( 'mkl_pc_theme_color_settings', function ( $settings ) {	$settings['highlight'] = array(		'default' => '#ff0',		'label'   => __( 'Highlight', 'my-plugin' ),	);	return $settings;} );
Theme colours.

Editor template actions

mkl_pc_choice_fields, mkl_pc_layer_fields, mkl_pc_angle_fields and mkl_pc_object3d_fields print into the editor's Underscore templates. In almost every case the *_default_settings filters are the better tool — they give you a real field with storage, validation and translation. Reach for these only for markup no field type can express.