-2

I have an affiliate website displaying product images. On the store, category & attribute pages I would like to remove the "Buy product" button.

I have found a lot of results for removing the "add to cart" button - but none of it works for the "Buy product" button on external products.

add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );

 function remove_add_to_cart_buttons() {
   if( is_product_category() || is_shop()) { 
     remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
   }
 }

Can anybody help me with this? Help is much appreciated!!

closed as off-topic by Max Yudin, Jacob Peattie, TheDeadMedic, fuxia Aug 30 '18 at 7:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

With an External/Affiliate product, if you leave the Product URL field empty, Woocommerce doesn't display the buy button. You could then add your own link to buy in the product's description. Add a class of "button" to the link and it'll look just like a proper button.

eg,

<a href="https://example.com" class="button">Buy now</a>

Not the answer you're looking for? Browse other questions tagged or ask your own question.