Title: Replace add to cart button
Last modified: November 3, 2020

---

# Replace add to cart button

 *  [mariodts](https://wordpress.org/support/users/mariodts/)
 * (@mariodts)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/)
 * Hi for my add to cart button i use this code
 *     ```
       add_filter( 'woocommerce_loop_add_to_cart_link', 'test_replace_add_to_cart_with_quickview', 10, 2 );
   
       function test_replace_add_to_cart_with_quickview( $html, $product ) {
   
         if ( method_exists( $product, 'get_id' ) ) {
           $product_id = $product->get_id();
         } else {
           $product_id = $product->id;
         }
   
       // Set HERE your button link
         $link = get_permalink($product_id);
         $html = '<a rel="nofollow" qv-id = "'.$product_id.'" class="woocommerce-LoopProduct-link quickview-button button">'.esc_html__('Select', 'test-plugin').'</a>';
   
         return $html;
       }
       ```
   
 * and works ok.
    But i want to replace it with the quick view button. How could
   i do this?
 * Thanks a lot

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/#post-13628698)
 * Hi there,
 * thanks for contact us!
    We are sorry to inform you that this is a feature of 
   premium version of quick view plugin and you can do it with the free one.
 * However, try to add this code to use the quick view button instead of add to 
   cart and to remove the default one:
 *     ```
       add_filter( 'woocommerce_loop_add_to_cart_link', 'test_replace_add_to_cart_with_quickview', 10, 2 );
   
       function test_replace_add_to_cart_with_quickview( $html, $product ) {
   
         if ( method_exists( $product, 'get_id' ) ) {
           $product_id = $product->get_id();
         } else {
           $product_id = $product->id;
         }
   
       // Set HERE your button link
         $link = get_permalink($product_id);
         $html = '<a rel="nofollow" data-product_id = "'.$product_id.'" class="woocommerce-LoopProduct-link yith-wcqv-button button">'.esc_html__('Select', 'test-plugin').'</a>';
   
         return $html;
       }
   
       if( function_exists( 'YITH_WCQV_Frontend' ) ){
           remove_action( 'woocommerce_after_shop_loop_item', array( YITH_WCQV_Frontend(), 'yith_add_quick_view_button' ), 15 );
       }
       ```
   
 * Let us know if works.
 *  Thread Starter [mariodts](https://wordpress.org/support/users/mariodts/)
 * (@mariodts)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/#post-13628775)
 * Thanks for your reply. I didnt know that was on pro. Worked perfectly.
 *  Thread Starter [mariodts](https://wordpress.org/support/users/mariodts/)
 * (@mariodts)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/#post-13629330)
 * one last question if possible. How to exclude this from yith wishlist page?
    
   Because i dont want there to enable the popup when i press the add to cart.
 * Thanks
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/#post-13657637)
 * Hi,
    if you want to show the add-to-cart button in the wishlist page, you could
   simply add a check in your function to check if the current page is the wishlist
   one, through this code snippet: `function_exists( 'yith_wcwl_is_wishlist' ) &&
   yith_wcwl_is_wishlist()`
 * So, your should simply edit your code as follows:
 *     ```
       add_filter( 'woocommerce_loop_add_to_cart_link', 'test_replace_add_to_cart_with_quickview', 10, 2 );
   
       function test_replace_add_to_cart_with_quickview( $html, $product ) {
   
       	if ( function_exists( 'yith_wcwl_is_wishlist' ) && yith_wcwl_is_wishlist() ) {
       		return $html;
       	}
   
       	if ( method_exists( $product, 'get_id' ) ) {
       		$product_id = $product->get_id();
       	} else {
       		$product_id = $product->id;
       	}
   
       	// Set HERE your button link
       	$link = get_permalink($product_id);
       	$html = '<a rel="nofollow" data-product_id = "'.$product_id.'" class="woocommerce-LoopProduct-link yith-wcqv-button button">'.esc_html__('Select', 'test-plugin').'</a>';
   
       	return $html;
       }
   
       if( function_exists( 'YITH_WCQV_Frontend' ) ){
       	remove_action( 'woocommerce_after_shop_loop_item', array( YITH_WCQV_Frontend(), 'yith_add_quick_view_button' ), 15 );
       }
       ```
   
 * Please try this solution and let us know if everything works fine!
 *  [prinka](https://wordpress.org/support/users/prinka/)
 * (@prinka)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/#post-14292702)
 * Hi can we add variation images in qucik view please help
    -  This reply was modified 5 years, 6 months ago by [prinka](https://wordpress.org/support/users/prinka/).

Viewing 5 replies - 1 through 5 (of 5 total)

 The topic ‘Replace add to cart button’ is closed to new replies.

 * ![](https://ps.w.org/yith-woocommerce-quick-view/assets/icon-128x128.gif?rev=
   3193930)
 * [YITH WooCommerce Quick View](https://wordpress.org/plugins/yith-woocommerce-quick-view/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-quick-view/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-quick-view/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-quick-view/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-quick-view/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-quick-view/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [prinka](https://wordpress.org/support/users/prinka/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/replace-add-to-cart-button-3/#post-14292702)
 * Status: not resolved