In Genesis Slack‘s WooCommerce channel, a user asked:
Totally random question but does anyone know how to remove the “Select Options” button in WooCommerce Shop Main page?
woocommerce_loop_add_to_cart_link
filter hook can be used to remove the Select options buttons for each variable product.
Add the following in child theme’s functions.php:
// Remove "Select options" button from (variable) products on the main WooCommerce shop page.
add_filter( 'woocommerce_loop_add_to_cart_link', function( $product ) {
global $product;
if ( is_shop() && 'variable' === $product->product_type ) {
return '';
} else {
sprintf( '%s',
esc_url( $product->add_to_cart_url() ),
esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ),
isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '',
esc_html( $product->add_to_cart_text() )
);
}
} );