1

I'm trying to remove a button that appears when hovering over the images on a woocommerce shop. (See images attached) icon that appears The product is a variable product.

Failing being able to do this I also tried to format it so it's a normal 'view product' button using the below code. However I'm struggling on how else to format it. Any help much appreciated.

// Change button text on WooCommerce Shop pages
add_filter( 'woocommerce_product_add_to_cart_text', 'woocustomizer_edit_shop_button_text' );

function woocustomizer_edit_shop_button_text() {
    global $product;
    $product_type = $product->get_type(); // Get the Product Type

    // Change text depending on Product type
    switch ( $product_type ) {
        case "variable":
            return __( '£', 'woocommerce' );
            break;
        case "grouped":
            return __( 'View All Products', 'woocommerce' );
            break;
        case "external":
            // Button label is added when editing the product
            return esc_html( $product->get_button_text() );
            break;
        default:
            return __( 'Buy Now', 'woocommerce' );
    }
}
New contributor
Gwell is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

Gwell is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.