View Categories

Wishlist for WooCommerce Developer Hooks and Filters Reference

Developer hooks and filters reference #

This reference lists the action and filter hooks exposed by Wishlist for WooCommerce for developers who want to extend it in a child theme or custom plugin. All hook names are current as of version 3.4.4. Add your callbacks in a custom plugin or your theme’s functions.php.

Action hooks #

Hook Fires when Arguments
alg_wc_wl_item_added A product is added to a wishlist. $item_id, $use_id_from_unlogged_user, $user_id
alg_wc_wl_item_removed A product is removed from a wishlist. $item_id, $use_id_from_unlogged_user, $user_id
alg_wc_wl_toggle_wish_list_item A toggle (add or remove) request finishes, just before the AJAX response is returned. $final_response
alg_wc_wl_import_line Each row is processed during a wishlist CSV import (Pro). $data
alg_wc_wl_import_complete A wishlist CSV import finishes (Pro). none

Filter hooks #

Filter Purpose
alg_wc_wl_enabled Return false to disable the whole plugin at runtime (for example on specific pages).
alg_wc_wl_btn_enabled Return false to hide the add-to-wishlist buttons for the current request.
alg_wc_wl_can_toggle_unlogged Return false to stop guests from toggling wishlist items.
alg_wc_wl_wish_list Filter the array of wishlisted item IDs. Receives $items and a context $args array.
alg_wc_wl_icon_html Filter the HTML markup of the wishlist icon.
alg_wc_wl_fa_icon_class Filter the Font Awesome class for a given context (copy, remove_btn, arrow_sorting_up, arrow_sorting_down, drag_and_drop).
alg_wc_wl_toggle_item_texts Filter the button/label texts used by the toggle button.
alg_wc_wl_remove_all_btn_label Filter the “Remove all” button label.
alg_wc_wl_remove_all_btn_html Filter the full “Remove all” button markup.
alg_wc_wl_default_email_subject Filter the default subject for the “share by email” message.
alg_wc_wl_show_default_btn / alg_wc_wl_show_thumb_btn Control whether the default or thumb button is rendered.
alg_wc_wishlist_js_obj / alg_wc_wishlist_js_modules_to_load Filter the JavaScript config object and the list of front-end JS modules.

Example: run code when an item is added #

add_action( 'alg_wc_wl_item_added', function ( $item_id, $is_guest, $user_id ) {
    // Your logic here, e.g. logging or a custom notification.
    error_log( sprintf( 'Product %d added to wishlist by user %s', $item_id, $user_id ) );
}, 10, 3 );

Example: hide the wishlist buttons on a specific page #

add_filter( 'alg_wc_wl_btn_enabled', function ( $enabled ) {
    if ( is_page( 'landing' ) ) {
        return false;
    }
    return $enabled;
} );

Need a hand? Our team answers every ticket on the Wishlist for WooCommerce support forum.