Woocommerce Wishlist button on content-single-product.php

We searched for this tirelessly!

In order to add the “Add to wishlist” button into your custom built content-single-product.php you must add this line to the top of your file:

global $wishlists;

Then add this code where you want the button to appear:

$wishlists -> add_wishlist_form();


If you need it without the quantity field just use this instead for the second part:

<form class="cart" method="post" enctype='multipart/form-data' action="<?php echo add_query_arg( array('add-to-wishlist-itemid' => $product->id), $product->add_to_cart_url() ); ?>">
  <input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>" />
  <?php $wishlists->add_to_wishlist_button(); ?>