WooCommerce: How to remove the add to cart button from specific product types

Here’s how you can remove the “Add to cart” button from a specific product

add_filter( 'woocommerce_loop_add_to_cart_link', 'remove_add_to_cart_buttons', 1 );
function remove_add_to_cart_buttons( $button ) {
    global $product;
    // Replace "external" with any product type you want to hide the button from
    if( $product->is_type( 'external' ) ){
        return '';
    }
 
    return $button;
}

You can add this code to your site following the instructions here:

How to add custom code to your WooCommerce/WordPress site the right way

Have any feedback? Be sure to let me know here: Contact me

Share your thoughts

Your email address will not be published. Required fields are marked *