WooCommerce: display “add to wishlist” button on shop page

WooCommerce has an excellent add-on called “WooCommerce Wishlists” that you can get here. This add-on adds an “add to wishlist” button on the product page by default. Here is a quick snippet to add this button on archive pages too (categories pages, main shop page etc…).

Here is the final result:

woocommerce-add-to-wishlist

Place that snippet in functions.php in your theme’s folder.

About the author

Remi Hey! My name is Rémi Corson, I'm a French WordPress Developer, I code stuff and I write from time to time ;-) Buy a coffee
Show your support

Related Posts

11 comments

  1. scott:

    Hi, the Add to Wishlist button appears under each product as shown but every add to wishlist button has a link of the current category page I am viewing and is unclickable. Nothing happens when I click on the button. Do you have any suggestions?

    Thank you.

  2. rwlee33:

    Hey Remi, I’m having the same problem. The button/text appears, but it does nothing when clicked.

    Can you help us out with this?

  3. Otina:

    Do you by any chance know a way (shortcode) of displaying the number of items in a wishlist?

  4. rwlee33:

    Hey Remi,
    I’m having the same issue as the others here. It adds the button, but the button doesn’t do anything.

    Additionally, I’d love to have the button NOT redirect to the product after clicking…is this possible?

    The idea being, the users can keep browsing, but quickly add to their wishlist.

    Thanks!

  5. rwlee33:

    Hey Remi…sorry keep pestering you about this. Do you know why the button displays, but doesn’t function? Thanks in advance for looking into this.

    Rob

  6. whoaloic:

    For me, the wishlist does not display in the shop page. :(

  7. richp:

    I have the same issue where the Add to Wishlist button displays but the wishlist html links are just a “#” and don’t do anything.

  8. erivier:

    I need remove the wishlist button in prodcuts for one category

  9. lukeseall@yahoo.co.uk:

    I know this is an old thread but…

    The reason the button isn’t clickable is because no wishlists exist. If you create a wishlist first then the button becomes clickable.

    The answer is to edit the woocommerce content-product.php template. Do this by editing the file in your theme rather than the Woocommerce plugin.

    At the top, where the global variables are declared add $wishlists. Separate by a comma.

    Then at the bottom, before the closing tag, add this form code

    <form class="cart" method="post" enctype='multipart/form-data' action=" $product->id), $product->add_to_cart_url() ); ?>”>
    <input type="hidden" name="add-to-cart" value="id ); ?>” />
    add_to_wishlist_button(); ?>

    There might be a neater way of doing this with hooks/filters but this does the job for now.

  10. kyokull76:

    I lost the content hompage when I add this code in function.php

Leave a Reply