1. Documentation /
  2. Plugins /
  3. WooCommerce /
  4. Product Likes

Product Likes

Allow users to like products in your WooCommerce store and view previous likes in their account.

Add like buttons with total likes to all products within your WooCommerce store – just like on social networks. Users can then click to like a product from the product page, category page and more. Users can view their previous likes when browsing your store and through their account, you can enable likes for users who aren’t logged in too.

Getting Started ↑ Back to top

  1. Install the extension
  2. Go to WooCommerce > Settings > Products > General > Product Likes
  3. Amend any of the settings required, we recommend keeping the settings as default
  4. View your store, you’ll see product like buttons on product pages and/or product archive pages
  5. Total likes show once a product has 1 or more likes
  6. Once you have likes head on over to Products > Likes to access the likes dashboard which shows how many likes products/customer have and you can view which products have been liked/which products specific customers have liked

Settings ↑ Back to top

You can access the settings at WooCommerce > Settings > Products > General > Product Likes

  • Enable Product Likes (Enables product likes across your store, ensure you also enable at least one of the display options below to see the buttons)
  • Enable If Not Logged In (Allows users without an account to like products, user will see their likes on products for 30 days or until cookies cleared. After this period likes by a not logged in user will still count towards the total number of product likes)
  • Enable In Account (Adds a section within the user’s account listing the products the customer has previously liked)
  • Show On Product Pages (Shows a product like button on individual product pages)
  • Show On Product Archive Pages (Shows a product like button on each product in an archive page e.g. shop page, product categories, etc)
  • Show Total Likes (Shows the total number of likes if a product has been liked)
  • Icon (Icon type used for product likes, Heart/Thumb/None)
  • Enable Styles (Adds styles to product likes, if disabled this will remove all styles from product likes including the icon chosen, this option should only be disabled if you wish to style product likes yourself with CSS)

Display ↑ Back to top

Product like buttons and total likes are shown on the product page and on each product in an archive page (e.g. product category), you can disable the display on either of these areas if needed. You can select the icon type (heart, thumb or none) or choose to remove all styling and style yourself with CSS.

Not Logged In Users ↑ Back to top

For users who aren’t logged in their likes will count towards the product’s like total and their likes will remain visible when they visit your store until their cookie expires or is deleted. You can disable this option if needed.

Dashboard ↑ Back to top

Within your dashboard you can go to Products > Likes and you will see a likes column on each product showing the total number of likes.

The likes dashboard can be accessed via Products > Likes and shows a list of your products and their likes total. You can click a like total to see which customers/how many guests liked the product.

It also includes a customer totals section which lists all customers, how many likes they’ve made and you can click the total likes to see which products they liked.

The likes dashboard and be searched/sorted and you can export/print all the data!

Post Meta ↑ Back to top

This extension stores product post meta with the key _wcpl_product_likes_likes for the total number of likes. This post meta should not be created/updated through the database, import, custom development or by using clone page/post/product plugins (with the exception of using the duplicate link on products in the dashboard product list) as it is related to data stored outside post meta in a database table for each individual like and both should remain in sync. If the post meta is added/updated you may see inconsistencies when attempting to like or unlike products. If you have attempted to create/update this post meta and have issues then you can resync the post meta by logging into your dashboard as an administrator and adding the query string wcpl_product_likes_debug_post_meta=1 to the admin URL and pressing enter e.g. http://example.com/wp-admin/?wcpl_product_likes_debug_post_meta=1

Cookies ↑ Back to top

The extension sets one cookie called wcpl_product_likes which is used to give a unique ID to a user who isn’t logged in so their likes are remembered until the cookie is removed.

Filters ↑ Back to top

We have included the following filters which you can use to manipulate the extension’s output as shown below.

You can use these filters within your theme’s functions.php file, see the examples below.

FilterDescription
wcpl_product_likes_like_text( $text )Change “Like” text
wcpl_product_likes_likes_text( $text )Change “Likes” text
wcpl_product_likes_likes_none_text( $text )Change text in my account when no products yet liked
wcpl_product_likes_products_alternative_hook( $bool )Return false to use default woocommerce_product_meta_start action hook, return true to use woocommerce_after_add_to_cart_form (not recommended) – see “Display on product pages” setting in the dashboard for further details
wcpl_product_likes_unlike_text( $text )Change “Unlike” text
wcpl_product_likes_total_before_text( $text )Change text which appears before total likes
wcpl_product_likes_total_after_text( $text )Change text which appears after total likes

Examples ↑ Back to top

Here are some examples of how you could use some of the filters above on your website to change references to “likes” to “loves”, remember to change the prefix and text domain to your own:

function your_prefix_like_text( $text ) {
	return __( 'Love', 'your-text-domain' );
}
add_filter( 'wcpl_product_likes_like_text', 'your_prefix_like_text' );

function your_prefix_likes_text( $text ) {
	return __( 'Loves', 'your-text-domain' );
}
add_filter( 'wcpl_product_likes_likes_text', 'your_prefix_likes_text' );

function your_prefix_likes_none_text( $text ) {
	return __( 'You have not loved any products yet.', 'your-text-domain' );
}
add_filter( 'wcpl_product_likes_likes_none_text', 'your_prefix_likes_none_text' );

function your_prefix_unlike_text( $text ) {
	return __( 'Unlove', 'your-text-domain' );
}
add_filter( 'wcpl_product_likes_unlike_text', 'your_prefix_unlike_text' );

function your_prefix_likes_total_before_text( $text ) {
	return __( 'Loved by', 'your-text-domain' );
}
add_filter( 'wcpl_product_likes_total_before_text', 'your_prefix_likes_total_before_text' );
	

function your_prefix_likes_total_after_text( $text ) {
	return __( 'people', 'your-text-domain' );
}
add_filter( 'wcpl_product_likes_total_after_text', 'your_prefix_likes_total_after_text' );

WooCommerce

The most customizable eCommerce platform for building your online business.

  • 30 day money back guarantee
  • Support teams across the world
  • Safe & Secure online payment