Support » Plugin: WooCommerce » WooCommerce external/affiliate product – remove buy button

  • Resolved wpinster



    I need a way to remove the BUY NOW button on External/Affiliate products when viewing the product page. Need to limit the scope of this to all External/Affiliate product types without it impacting other product types like Simple product.

    Any thoughts would be appreciated.


Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mike Jolley


    These product types do not have a buy button. WC core shows a link to the external product only with the text you define.

    Hi Mike,

    Thanks. Yes, that is correct. I need to remove that button that holds the link & text. But only from External/Affiliate product types.


    Hi Mike,

    Looks like if I leave the link and button text as blank the button is not displayed. Did;t think that was possible, but it works. Thanks. marking as resolved.

    Can someone give me a basic code to remove the buy button on my main woocommerce shop page? (Not the actual product page, just the general main page that lists the products). Also, I don’t know where to put it. Thanks!

    At the very least I need to make it small because it’s huge. Again, just on main page. 🙂


    Please paste the following code snippet in your theme’s functions.php file.

    add_filter( 'woocommerce_loop_add_to_cart_link', 'sfws_add_product_link' );
    function sfws_add_product_link( $link ) {
    	global $product;
    	$product_id = $product->id;
    	$_product = wc_get_product( $product_id );
    	if($_product->product_type == 'external'){
    		$link = '';
    	return $link;

    It will remove the Buy Now button from the shops page with external or affiliate product type. Let me know if you need any thing else.


    • This reply was modified 3 years, 7 months ago by Arif.
    • This reply was modified 3 years, 7 months ago by Arif.

    Hi Arif,

    That snippet worked great, thank you. But I have a question. I would like to change the price button text on the product thumbnails to say “View Product” instead. If it’s possible, could you give me the code to make that change, or direct me to where I can make the change myself? I’d really appreciate it. Thank you so much!


    • This reply was modified 3 years, 4 months ago by .
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WooCommerce external/affiliate product – remove buy button’ is closed to new replies.