Skip to content

Wishlist

The wishlist lets customers save products for later. It works for both logged-in customers and guests.

Wishlist, compare and quick view on the store page

Go to WooCommerce > Polski > Storefront Modules and activate the Wishlist option. After enabling, a heart icon will appear on each product allowing it to be added to the list.

For guests, the wishlist is stored in the browser’s localStorage. Data is available immediately without server requests. After logging in, the localStorage list is automatically synchronized with the database - products are not lost.

For logged-in customers, data is saved in the wp_usermeta table with the key _polski_wishlist. This makes the list available on any device after logging in.

The module adds a new Wishlist tab in the My Account WooCommerce section. The customer sees:

  • Product thumbnail
  • Name with a link to the product page
  • Price (current, including promotions)
  • Availability status (in stock / out of stock)
  • Add to cart button
  • Remove from list button

The tab is visible only when the module is active. The URL endpoint is wishlist - e.g. yourstore.com/my-account/wishlist/.

Adding and removing products from the list works via AJAX - the page is not reloaded. After clicking the heart icon:

  1. The icon changes state (empty/filled) with a CSS animation
  2. An AJAX request is sent to admin-ajax.php
  3. The counter on the header icon updates in real time

AJAX actions handled by the module:

ActionDescription
polski_wishlist_addAdd product to the list
polski_wishlist_removeRemove product from the list
polski_wishlist_getGet the entire list
polski_wishlist_clearClear the entire list

The shortcode displays the wishlist table anywhere in the store.

ParameterTypeDefaultDescription
columnsstringallColumns to display (comma-separated)
max_itemsint50Maximum number of products on the list
show_emptystringyesWhether to show a message when list is empty
[polski_wishlist columns="image,name,price,add_to_cart" max_items="20"]
echo do_shortcode('[polski_wishlist columns="image,name,price,add_to_cart"]');
  • image - product thumbnail
  • name - product name with link
  • price - price
  • stock - stock status
  • add_to_cart - add to cart button
  • remove - remove from list button
  • date_added - date added

The wishlist button displays by default below the Add to Cart button on the product page. The position can be changed with a filter:

add_filter('polski/wishlist/button_position', function (): string {
return 'before_add_to_cart'; // or 'after_add_to_cart', 'after_summary'
});

On category and archive pages, a heart button appears on the product thumbnail in the corner. This can be disabled in module settings.

The module adds a heart icon with a counter to the store header (next to the cart). Clicking opens a dropdown with a preview of saved products. The icon position is controlled by a hook:

add_action('polski/wishlist/header_icon', function (): void {
// Custom icon position in the header
});

The module uses CSS classes with the .polski-wishlist- prefix. Main classes:

  • .polski-wishlist-button - add/remove button
  • .polski-wishlist-button--active - active state (product is on the list)
  • .polski-wishlist-table - list table
  • .polski-wishlist-count - header counter
  • .polski-wishlist-empty - empty list message

Wishlist data for logged-in users is cached in object cache (if available). The button HTML fragment is cached via wp_cache_set() with the polski_wishlist group. Cache is automatically cleared after adding or removing a product.

Button does not appear on the product - make sure the theme supports the woocommerce_single_product_summary hook. Some themes override default WooCommerce templates.

List does not synchronize after login - check if you have a caching plugin that aggressively buffers the login page. Disable cache for the my-account page.

Header icon does not display - the theme must support the wp_nav_menu_items or storefront_header hook. If you use a custom theme, add the icon manually in the template.

Report issues: github.com/wppoland/polski/issues

This page is for informational purposes only and does not constitute legal advice. Consult a lawyer before implementation. Polski for WooCommerce is open source software (GPLv2) provided without warranty.