Skip to content

Hooks and Filters

“SilentJMA” edited this page Jun 18, 2026 · 1 revision

Hooks and Filters

Reference for all WordPress actions and filters provided by the plugin. Use these to extend or customize plugin behavior from your theme or custom plugin.

Actions

Plugin Lifecycle

Hook Trigger Params
mirakl_connector_loaded Plugin fully loaded None
mirakl_loaded New architecture plugin booted $plugin

Orders

Hook Method Description
woocommerce_order_status_changed handle_order_status_transition() 4 params: $order_id, $from, $to, $order. Triggers shipping notification on completed status.
mirakl_connector_order_shipped handle_order_shipped() Fired when a Mirakl order is shipped in WooCommerce
woocommerce_admin_order_data_after_shipping_address render_order_actions_panel() Renders the Mirakl Actions metabox on order edit page (priority 25)

Admin

Hook Method Description
admin_menu add_admin_menu() Registers all admin menu pages
admin_enqueue_scripts enqueue_scripts() Loads JS/CSS on plugin admin pages
admin_body_class add_body_class() Adds mirakl-connector-admin body class
admin_init handle_manual_order_actions() Processes manual order action form submissions
admin_notices render_order_action_notice() Shows action result notices
admin_notices bulk_action_notice() Shows bulk action results
admin_head product_list_css() Product list column CSS

Products

Hook Method Description
woocommerce_product_options_general_product_data add_product_active_checkbox() Adds "Active in Mirakl" checkbox
woocommerce_process_product_meta save_product_active_checkbox() Saves Mirakl active state
woocommerce_product_options_general_product_data add_brand_gtin_fields() Adds Brand + GTIN fields
woocommerce_process_product_meta save_brand_gtin_fields() Saves Brand/GTIN
manage_edit-product_columns add_product_column() Adds Mirakl column to product list
manage_product_posts_custom_column populate_product_column() Populates Mirakl column
manage_edit-product_sortable_columns add_sortable_column() Makes Mirakl column sortable
woocommerce_product_quick_edit_end quick_edit_field() Quick edit field
woocommerce_product_quick_edit_save quick_edit_save() Save quick edit
woocommerce_product_bulk_edit_end bulk_edit_field() Bulk edit field
woocommerce_product_bulk_edit_save bulk_edit_save() Save bulk edit
bulk_actions-edit-product register_bulk_actions() Register bulk activate/deactivate
handle_bulk_actions-edit-product handle_bulk_actions() Process bulk actions

Email Suppression

Hook Callback Description
woocommerce_email_enabled_customer_on_order_received maybe_disable_mirakl_order_email() Disables WC emails for Mirakl orders
woocommerce_email_enabled_customer_on_order_completed maybe_disable_mirakl_order_email() Same
woocommerce_email_enabled_customer_on_order_processing maybe_disable_mirakl_order_email() Same
woocommerce_email_enabled_customer_on_order_on_hold maybe_disable_mirakl_order_email() Same

Cron

Hook Method Description
mirakl_connector_auto_stock_sync_cron cron_auto_stock_sync() Stock sync cron
mirakl_connector_prices_sync_cron cron_prices_sync() Price sync cron
mirakl_connector_products_sync_cron cron_products_sync() Product sync cron
mirakl_connector_orders_import_cron cron_orders_import() Order import cron
mirakl_connector_tracking_update_cron cron_tracking_update() Tracking update cron

AJAX

Hook Method Description
wp_ajax_mirakl_get_store_stats ajax_get_store_stats() Dashboard stats
wp_ajax_mirakl_sync_product ajax_sync_product() Single product sync
wp_ajax_mirakl_import_products ajax_import_products() Product import
wp_ajax_mirakl_export_products ajax_export_products() Product export
wp_ajax_mirakl_import_orders ajax_import_orders() Order import
wp_ajax_mirakl_sync_inventory ajax_sync_inventory() Legacy stock sync
wp_ajax_mirakl_sync_stock ajax_sync_stock() v2 async stock sync
wp_ajax_mirakl_sync_price ajax_sync_price() v2 async price sync
wp_ajax_mirakl_sync_orders ajax_sync_orders() v2 async order sync
wp_ajax_mirakl_test_connection ajax_test_connection() v5 API test connection
wp_ajax_mirakl_attr_sync ajax_attr_sync() Sync PM11/VL11 attributes
wp_ajax_mirakl_attr_load_tree ajax_attr_load_tree() Load category tree
wp_ajax_mirakl_attr_load_panel ajax_attr_load_panel() Load attribute panel

Filters

Filter Params Description
mirakl_connector_api_credentials $credentials, $store_name Override store credentials programmatically
mirakl_connector_allowed_product_types $types Filter which product types are included in sync
mirakl_format_product_data $product_data, $product Modify product data before export
mirakl_connector_attribute_sync_locale $locale Override locale for PM11 attribute sync
mirakl_effective_stock_quantity $quantity, $product Modify effective stock calculation
mirakl_sync_lock_ttl $ttl, $store_name, $type Modify sync lock TTL
mirakl_order_before_create $order_data, $mirakl_order Modify order data before WC order creation

Examples

Custom Credential Override

add_filter('mirakl_connector_api_credentials', function ($credentials, $store_name) {
    if ('my-store' === $store_name) {
        $credentials['api_endpoint'] = 'https://custom-endpoint.mirakl.net';
        $credentials['api_key'] = getenv('MIRAKL_CUSTOM_KEY');
    }
    return $credentials;
}, 10, 2);

Exclude Product Types

add_filter('mirakl_connector_allowed_product_types', function ($types) {
    // Remove variable products from sync
    return array_diff($types, ['variable']);
});

Modify Exported Product Data

add_filter('mirakl_format_product_data', function ($data, $product) {
    $data['my-custom-field'] = get_post_meta($product->get_id(), '_my_field', true);
    return $data;
}, 10, 2);

Clone this wiki locally