Display the wishlist items in a list or grid

This article only applies to the pro version of the plugin.

The wishlist items are displayed by default as a list of items in a table. In the pro version, you can toggle the display between the list and grid modes as shown in the screenshots below.

List view
Grid view

The toggling is only set up by default on the wishlist page as this is where most store owners want the wishlists to be toggled between the list and grid modes. In the wishlist account area and in the admin, the wishlist items remain displayed in the default list table mode.

On the frontend however, this default setup can be changed to match your needs.

For example if you want all wishlist items be displayed in the grid mode, you can set this up using the code below:

add_action( 'wp', function () {
	if ( function_exists( 'is_nmgr_wishlist' ) && is_nmgr_wishlist() &&
		wc()->session && 'grid' !== wc()->session->get( 'nmgr_items_display_mode' ) ) {
		wc()->session->set( 'nmgr_items_display_mode', 'grid' );
} );

We have targetted the action to run only on the wishlist page using is_nmgr_wishlist().

To prevent users from toggling the grid mode after it has been set, you can also use css to hide the container.

.nmgr-display-modes {display: none;}