Black Friday

30% off premium pluginsEnds 2 December

Shop the sale
Simple Wishlists

How can we help?

Search the documentation or ask the AI agent anything about the plugin.

Filter hooks reference

Simple WishlistsUpdated

These filters change how the wishlist behaves without editing the plugin. Add them to your child theme’s functions.php or a code snippets plugin. Filters marked PRO only run when the PRO version is active.

Button and counter

  • swlp_show_button ( bool $show, WC_Product $product, string $context ): whether the button shows. $context is single, loop, shortcode or block.
  • swlp_button_html ( string $html, WC_Product $product, array $args ) and swlp_counter_html ( string $html, array $args ): change the markup.
  • swlp_can_add_product ( bool $can, WC_Product $product, int $variation_id ) and swlp_allow_product_type ( bool $allowed, WC_Product $product ): block products from being saved.

Limits and permissions

  • swlp_max_items ( int $max, array $list ) and swlp_max_lists ( int $max, array $owner )
  • swlp_user_can_view_list and swlp_user_can_edit_list ( bool $can, array $list, array|null $owner )
  • swlp_is_enabled ( bool $enabled ): turn wishlists off on some pages or for some visitors.
  • swlp_rate_limit ( int $limit, string $bucket ) and swlp_client_ip ( string $ip ): for stores behind a proxy that does not pass the real visitor IP.

Wishlist page and items

  • swlp_wishlist_sort_options ( array $options ): the Sort by choices.
  • swlp_item_view ( array $view, array $item, WC_Product $product, array $list ): the data used to show one item.
  • swlp_item_stock_badge, swlp_item_is_available, swlp_item_cart_action, swlp_list_summary
  • swlp_empty_popular_products ( array $products, int $limit ) and swlp_shop_url ( string $url )
  • swlp_account_tabs ( array $tabs ) and swlp_account_stats ( array $stats, array|null $owner ): the My Account dashboard tabs and stat cards.
  • swlp_account_endpoint ( string $slug ): re-save permalinks after changing it.
  • swlp_default_list_title ( string $title ): the name of a customer’s first list.

Sharing

  • swlp_share_networks ( array $networks, array $list ) and swlp_share_text ( string $text, array $list )
  • swlp_share_url, swlp_share_slug, swlp_wishlist_url
  • swlp_shared_list_indexable ( bool $indexable, array $list )

Emails and engagement (PRO)

  • swlp_email_registry, swlp_email_replacements ( array $replacements, string $email_id, array $context ), swlp_email_before_send
  • swlp_user_wants_email ( bool $wants, int $user_id, string $type ) and swlp_campaign_send_to_user ( bool $send, int $user_id, array $campaign )
  • swlp_item_wants_alert ( bool $wants, array $item, string $type ) and swlp_alert_events
  • swlp_attribution_window_days ( int $days ): default 30.
  • swlp_priority_levels ( array $levels ), swlp_registry_search_types, swlp_estimate_recipients

Performance and data

  • swlp_load_frontend_assets ( bool $needs ): whether the scripts load on a page.
  • swlp_frontend_data ( array $data ): the data passed to the storefront script.
  • swlp_events_retention_days, swlp_guest_cookie_name, swlp_scheduler_use_action_scheduler
  • swlp_is_cross_site_request ( bool $cross_site, string $fetch_site ): return false to accept requests from a storefront on another domain, such as a headless site.

Examples

<?php
// PHP: hide the wishlist button on products that cost less than 10.
add_filter( 'swlp_show_button', function ( $show, $product, $context ) {
	return $show && (float) $product->get_price() >= 10;
}, 10, 3 );

// PHP: allow up to 500 items per wishlist.
add_filter( 'swlp_max_items', function () {
	return 500;
} );

Related

Was this article helpful?